Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

web.config transformation does not work on build server

We are setting up continuous integration with team city doing builds on check-ins. This works fine, however it always builds with default web.config, it does not transform with development environment specific web config. In Visual Studio, I have custom build configuration created for development. The web.development.config transforms correctly when I publish locally with development configuration selected, but this does not happen on the build server. In team city, as part of msbuild step I have created a build parameter sys.configuration and I am passing development as the value. But when it runs, the resulting web.config is not transformed with the development settings. I also tried setting the command line parameter to /p:configuration=development with no success.

Any help will be much appreciated.

like image 688
jack Avatar asked Feb 15 '16 09:02

jack


1 Answers

We've been using publish targets in our web application projects and had seen that the build process was correctly transforming our web.config files, but when we moved the build to our CI server, the transforms were not being applied.

The MSBuild script were using was:

MSBuild.exe PATH_TO_PROJ.csproj /p:DeployOnBuild=true /p:PublishProfile=PUBLISH_TARGET

What we found was that we still needed to specify the Configuration as Debug or Release (even though this appears to be an attribute of the publish target.)

MSBuild.exe PATH_TO_PROJ.csproj /p:DeployOnBuild=true /p:PublishProfile=PUBLISH_TARGET /p:Configuration=Release

like image 186
Brian Merrell Avatar answered Sep 27 '22 21:09

Brian Merrell