使用Nant将TeamCity内部版本号获取到AssemblyInfo文件中 [英] Getting the TeamCity build number into the AssemblyInfo file using Nant

查看:93
本文介绍了使用Nant将TeamCity内部版本号获取到AssemblyInfo文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经进行了大量谷歌搜索,但似乎找不到确切的解决方案将TeamCity内部版本号输入到我的AssemblyInfo文件中.希望能为我的要求提供完整的解决方案...

I have done a lot of googling but cant seem to find an exact solution to get the TeamCity build number into my AssemblyInfo files. Would appreciate a full solution for my requirements...

1将内部版本号放入Nant变量中.我相信这段代码将完成此任务.

1 Get the build number into a Nant variable. I believe that this code will accomplish this..

   PropertyGroup

      Version$(BUILD_NUMBER)/Version

/PropertyGroup 

(在SO中尽可能重复).

(repoduced as best as possible in SO).

2现在,我需要一种方法来更新版本号的修订组件,以便获得1.0.0.[内部版本号]之类的信息.

2 Now I need a way to update the revision component of my version numbers so I get something like 1.0.0.[build number].

3理想情况下,我需要将整个对象放在可重复使用的Nant目标中,以便可以将其传递到要更新的程序集信息文件的路径中.

3 Ideally I need the whole thing in a re-usable Nant target so that I can just call it passing in the path to the assembly info file that i want to update.

如果您可以帮助我,请在此处发布完整的解决方案,并附上说明,而不是指向其他网站的链接.我已经看了很多在线示例,但似乎找不到适合我需要的示例-因此,我要求了解无所不能的SO社区!

I would respectfully request that if you can help me that a full solution is posted here with explanation as opposed to links to other sites. Ive looked at a lot of online examples but cant seem to find one that fits what I need - therefore I request the knowledge of the omnipotent SO community!

谢谢.

推荐答案

首先,问题中的代码段是MSBuild语法,而不是NAnt.假设NAnt是您的构建工具,那么如何使用Cruise Control.NET

First of all, the code snippet in your question is MSBuild syntax, not NAnt. Assuming that NAnt is your build tool, there is a good explanation of how to update AssemblyInfo files with Cruise Control.NET here. That applies to TeamCity as well, just replace "CCNetLabel" with "build.number" and you will be fine.

要获得1.0.0.[内部版本号]之类的版本号,可以在TeamCity内部版本配置中完成.在第一个配置页面上(常规设置).将内部版本号格式"从"{0}"更改为"1.0.0.{0}".有关更多选项,请参见在线帮助.

To get a version number like 1.0.0.[build number], you can accomplish that in the TeamCity build configuration. On the first configuration page (General Settings). Change the "Build Number Format" from "{0}" to "1.0.0.{0}". See the online help for more options.

这篇关于使用Nant将TeamCity内部版本号获取到AssemblyInfo文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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