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

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

问题描述

我尝试使用配置转换在连续集成环境中。



我需要一种方法告诉TFS构建代理执行转换。我希望它只是工作后发现配置转换文件(web.qa-release.config,web.production-release.config,etc ...)。但它不是。



我有一个TFS构建定义,构建正确的配置(qa发布,生产版本等等),我有一些在这些定义中构建的特定.proj文件以及包含一些特定于环境的参数,例如:

 < 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中的创建,以启动转换和吹走个别转换文件?

解决方案




  1. 转到团队资源管理器>

  2. 编辑构建定义(或创建新构建)

  3. 在处理步骤中,有要构建的配置的设置。 / li>

在我的例子中,我设置了一个CI配置,然后执行正确的web.config转换。确保您已添加CI转换文件,您应该很好去。


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

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.

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>

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?

解决方案

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

  1. Goto Team Explorer > Builds
  2. Edit your build definition (or create new)
  3. Under the "Process" step there is a settings for "Configurations to Build".

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天全站免登陆