Search code examples
c#msbuildteamcityslowcheetahteamcity-10

Teamcity - Transform web.config and password.config upon build using MSBuild SlowCheetah 2.5.48


I'm using TeamCity (TeamCity Enterprise 10.0.4 (build 42538)) as a build server and SlowCheetah for config transformations. My solution consist of one ASP.NET Web API 2 project and one Console application.

For my console application the transformation works flawlessly for Release configuration. This is done via the Visual Studio runner set for Microsoft Visual Studio 2015.

enter image description here

However for publishing I use the MSBuild runner instead and here transformation does not work at all. I need to transform both a web.config file and separate password.config file. I'm using SlowCheetah 2.5.48. When publishing through Visual Studio in my development environment transformation works flawlessly as well.

enter image description here


Solution

  • Solved it by adding two system properties, added system.PublishUrl to have separate folder from development environment but it is not needed.

    Needed parameters:

    • system.PublishProfile - set to the value of your PublishProfile (such as Release)
    • system.DeployOnBuild - set to true

    When this is done TeamCity will automatically pass these parameters to your Visual Studio build step and transformation now works.

    enter image description here

    After this I could remove the MSBuild step and only use Visual Studio Runner.