So. My problem is as follows:
I am working on a medium size web site in Visual Studio 2013. Whenever I do a check in, TeamCity is publishing my website to Azure. All this works as expected, but now that we have been working on the project for a while, we want to do a publish to a demo server as well.
I have created a configuration in the Visual Studio Configuration Manager called Deploy-Test
, and have a working publish profile called Deploy-Demo.pubxml
.
In my build.proj
file I have the following target:
<Target Name="DeployDemoWebsite" DependsOnTargets="VersionAssemblies">
<Message Text="Deploying $(ProjectName) Demo Website" />
<MSBuild Projects="Source\$(ProjectName).sln" Targets="Build" Properties="DeployOnBuild=True;PublishProfile=Deploy-Demo;Configuration=Deploy-Demo;" />
<Message Text="Deployed $(ProjectName) Demo Website!" />
</Target>
Also, in the pubxml
-file, I have specified the configuration:
<LastUsedBuildConfiguration>Deploy-Demo</LastUsedBuildConfiguration>
Everything is working except web.config transformations.
Whenever I do a check in, Teamcity starts to build and deploy the new version, but in the build log, I see the following:
[11:24:35][Source\WebUi\WebUi.csproj] TransformWebConfigCore
[11:24:35] [TransformWebConfigCore] TransformXml
[11:24:35] [TransformXml] Transforming Source File: D:\TeamCity\buildAgent\work\855eef14c36558c5\Source\WebUi\Web.config
[11:24:35] [TransformXml] Applying Transform File: D:\TeamCity\buildAgent\work\855eef14c36558c5\Source\WebUi\Web.Debug.config
[11:24:35] [TransformXml] Output File: obj\Debug\TransformWebConfig\transformed\Web.config
[11:24:35] [TransformXml] Transformation succeeded
If I use the Publish menu item in Visual Studio and publish to file system, it all works as expected, and my web.config gets transformed using the expected transformation file.
I have tried setting the parameter in TeamCity under Build Step: MSBuild
. It did not help.
Have any of you ever experienced this?
You should specify the Configuration value as a part of your build process. It cannot be set in the .pubxml. More details on my blog http://sedodream.com/2012/10/27/MSBuildHowToSetTheConfigurationProperty.aspx.