web.config changes via TFS 2015 Release Management web.config changes via TFS 2015 Release Management powershell powershell

web.config changes via TFS 2015 Release Management


Both Web Deploy's parameters.xml method and transforms can be used with Release Management. Transforms would be triggered from Build and the process of replacing tokens created by a publish would be triggered by Release Management.

To trigger transforms during the build, you can do this one of two ways:

  1. Add the following MSBuild parameters to force the transformation to happen during the build

    /p:UseWPP_CopyWebApplication=true /p:PipelineDependsOnBuild=false

  2. Create a publish profile using the MSDeploy Package option and then trigger the packaging in Build using the following MSBuild parameters:

    /p:DeployOnBuild=true /p:PublishProfile=[nameOfProfile]

Either of the above methods will cause normal Web.config XDT's to run. If you need other XML files to be transformed, you'll need to first install SlowCheetah.

Token Replace and Parameters

Now that you have a build artifact with XDT's run, you can use token replacement and the WinRM tasks from Release Management. These will take the Web Deploy package from the Build and execute the SetParameters command before deploying it. The trick is to take the SetParameters.xml file and run a token replace on it first, swapping out Release environment variables first.


User Sumo gave a proper answer, but I want to record some comments related to what instead of how.

IMHO there are different categories of settings to consider, let's exemplify. The database connection string changes at each environment, while requiring SSL should be turned on for all testing and production environments.In this perspective, you should have settings applied as early as possible, traditionally at build time and called Debug/Release builds; and last-minute settings, environment dependent, up to runtime settings, like Feature toggles.

So in my view you can use a single tool or multiple tools, but it is important that you properly categorize your settings accordingly.