在 TFS 2010 或 msbuild 中触发配置转换 [英] trigger config transformation in TFS 2010 or msbuild

查看:26
本文介绍了在 TFS 2010 或 msbuild 中触发配置转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 配置转换 在持续集成环境中.

I'm attempting to make use of configuration transformations in a continuous integration environment.

我需要一种方法来告诉 TFS 构建代理执行转换.我有点希望它在发现配置转换文件(web.qa-release.config、web.production-release.config 等)后能正常工作.但它没有.

I need a way to tell the TFS build agent to perform the transformations. I was kind of hoping it would just work after discovering the config transform files (web.qa-release.config, web.production-release.config, etc...). But it doesn't.

我有一个 TFS 构建定义来构建正确的配置(qa-release、production-release 等...),并且我有一些特定的 .proj 文件在这些定义中构建,这些文件包含一些特定于环境的参数,例如:

I have a TFS build definition that builds the right configurations (qa-release, production-release, etc...) and I have some specific .proj files that get built within these definitions and those contain some environment specific parameters eg:

<PropertyGroup Condition=" '$(Configuration)'=='production-release' ">
    <TargetHost Condition=" '$(TargetHost)'=='' ">qa.web</TargetHost>
    ...
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)'=='qa-release' ">
    <TargetHost Condition=" '$(TargetHost)'=='' ">production.web</TargetHost>
    ...
</PropertyGroup>

我从输出中知道正在构建正确的配置.现在我只需要学习如何触发配置转换.是否有一些我可以添加到构建中的最终 .proj 以启动转换并清除单个转换文件的欺骗性欺骗?

I know from the output that the correct configurations are being built. Now I just need to learn how to trigger the config transformations. Is there some hocus pocus that I can add to the final .proj in the build to kick off the transform and blow away the individual transform files?

推荐答案

您需要做的就是设置应该在 TFS 构建定义中使用哪个配置.

All you should need to do is setup which configuration should be used within the TFS build definition.

  1. 转到团队资源管理器 > 构建
  2. 编辑您的构建定义(或创建新的)
  3. 在流程"步骤下,有一个要构建的配置"设置.

就我而言,我专门为 CI 设置了一个配置,然后执行正确的 web.config 转换.确保您已添加CI"转换文件,您应该可以开始使用了.

In my case I have setup a configuration specifically for CI that then performs the correct web.config transformations. Ensure that you have added the "CI" transform file and you should be good to go.

这篇关于在 TFS 2010 或 msbuild 中触发配置转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆