Teamcity坚持使用“调试”配置进行发布

时间:2014-08-01 10:26:40

标签: msbuild continuous-integration teamcity msdeploy

因此。我的问题如下:

我正在使用Visual Studio 2013中的中型网站。每当我办理登机手续时,TeamCity都会将我的网站发布到Azure。所有这一切都按预期工作,但既然我们已经在项目上工作了一段时间,我们也希望发布到演示服务器。
我在Visual Studio配置管理器中创建了一个名为Deploy-Test的配置,并且有一个名为Deploy-Demo.pubxml的工作发布配置文件。

在我的build.proj文件中,我有以下目标:

<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>

此外,在pubxml - 文件中,我已指定配置:

<LastUsedBuildConfiguration>Deploy-Demo</LastUsedBuildConfiguration>

除了 web.config转换外,其他所有内容都在

每当我办理登机手续时,Teamcity都会开始构建和部署新版本,但在构建日志中,我看到以下内容:

[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

如果我使用Visual Studio中的“发布”菜单项并发布到文件系统,它将按预期工作,并使用预期的转换文件转换我的web.config。

我尝试在Build Step: MSBuild下的TeamCity中设置参数。它没有帮助。

你们有没有经历过这个?

1 个答案:

答案 0 :(得分:2)

您应该将Configuration值指定为构建过程的一部分。它不能在.pubxml中设置。有关我的博客http://sedodream.com/2012/10/27/MSBuildHowToSetTheConfigurationProperty.aspx的详细信息。