TFS Build 2015 Not Transforming Web.Config




- May 29, 2017

Rest of the Story:

The following is the solution that addressed this problem. While setting up a project for TFS build, I came across issues with the build system not transforming my web.config to different configurations. i.e. I want my web.config to be transformed with web.config.release upon build/publish. I found the following solution that worked for me.

Within Visual Studio, unload the web project (in this case I am working with a web application), scroll to the bottom and add the following task. On the build server you can ensure that the path is valid and it is referencing the most appropriate version. The UsingTask imports the TransformXml method from Microsoft.Web.Publishing.Tasks.dll

Then within the BeforeBuild Target add Exec removes the read-only attribute from the web.config file and the CallTarget will ApplyTransform target tfs2