This is one of those misleading topics: packaging and deploying web applications (deduced from the reference to web.config, correct me if I am wrong).
Packaging and deploy
TFS is agnostic toward the kind of code you are compiling, so you have to instruct the "Visual Studio" build system that is invoked by TFS to compile in the MSBuild step.
In the ALM Rangers' Build Guidance there are specific section on this. In the web-app case one typically set MSBuild arguments to something like
/p:DeployOnBuild=True /p:Configuration=QA /p:DeployIisAppPath="web.qa.contoso.com" /p:DeployTarget=Package
to get a Zip file, to be used with WebDeploy.
Selecting content
In case you need different content to create different packages, there is a simple neat trick for TFVC (don't work with Git). Say you want to have a QA package and a Production package with two different JPGs (or keys to sign, or certificates, whatever). The two version of the file are $/MyProj/Special/Prod.jpg
and $/MyProj/Special/QA.jpg
. Create two TFS Build Definitions, and map this way
| Build | Status | Source Control Path | Build Agent Path |
|-------|--------|----------------------------|-------------------------------|
| QA | Active | $/MyProj | $(SourceDir)\ |
| QA | Cloak | $/MyProj/Special | |
| QA | Active | $/MyProj/Special/QA.jpg | $(SourceDir)\Special\logo.jpg |
|-------|--------|----------------------------|-------------------------------|
| Prod | Active | $/MyProj | $(SourceDir)\ |
| Prod | Cloak | $/MyProj/Special | |
| Prod | Active | $/MyProj/Special/Prod.jpg | $(SourceDir)\Special\logo.jpg |