msbuild - Teamcity 坚持使用 "debug"配置进行发布

标签 msbuild continuous-integration teamcity msdeploy

所以。我的问题如下:

我正在 Visual Studio 2013 中开发一个中型网站。每当我 checkin 时,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 转换。

每当我 checkin 时,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 将使用预期的转换文件进行转换。

我尝试在 TeamCity 中的构建步骤:MSBuild 下设置参数。这没有帮助。

你们有过这样的经历吗?

最佳答案

您应该指定配置值作为构建过程的一部分。无法在 .pubxml 中设置它。更多详情请参阅我的博客 http://sedodream.com/2012/10/27/MSBuildHowToSetTheConfigurationProperty.aspx .

关于msbuild - Teamcity 坚持使用 "debug"配置进行发布,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25078162/

相关文章:

.net - MSBuild 条件 IsDebug

tfs - 如何避免在不使用忽略属性的 mstest 中运行测试?

continuous-integration - Drone.io 在本地构建而不推送到 repo

javascript - 关于将闭包编译器集成到构建流程的建议

ios - 设置 TeamCity 以集成到 OSX Build Agent

events - 你能阻止 MSBuild.exe 运行生成事件吗?

visual-studio-2010 - 如何在特定配置下构建解决方案中的所有项目(就像您选择 "Rebuild Solution"一样)

mercurial - 在 Cruisecontrol.net 中更改 DVCS 的操作流程?

teamcity - YouTrack 和 TeamCity 背后的技术堆栈

git - 内部版本号中的分支名称