使用文件中的计数器设置Teamcity版本号 [英] Setting Teamcity version number with counter from file

查看:112
本文介绍了使用文件中的计数器设置Teamcity版本号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在尝试更新版本号.在TeamCity中使用包含版本号的Nant构建文件. 如果我只是使用

I'm currently trying to update the version no. in TeamCity using a Nant build file, containing the version number. If I just use

<property name="versionNo" value="2.16.3."/>
.
.
<echo message="##teamcity[buildNumber '${versionNo}']"></echo> 

在脚本中,buildNumber更新为2.16.3,但我也想在此版本号上添加计数器. 表示我想拥有

In the script the buildNumber is update to 2.16.3 but I would also like to have the counter on this version number. Meaning I would like to have

<echo message="##teamcity[buildNumber '${versionNo}.{0}']"></echo> 

但这不起作用. 有人知道如何执行此操作吗,在此解决方案中尝试了很多事情 http://binary-notes.blogspot.com/2011/05/controlling-application-version-number.html ,但是$ {Version}参数对我来说是一个线索吗?

But this doesn't work. Does anybody know how to do this, tried many things among this solution http://binary-notes.blogspot.com/2011/05/controlling-application-version-number.html however, the ${Version} parameter is a clue for me ?

通过在Teamcity中使用{0}作为内部版本号并将该内部版本号附加到文件中我自己的内部版本号来实现

Made the implementation by using {0} as buildnumber in Teamcity and appending that build number to my own build number in the file

<property name="versionNo" value="2.16.3."/>
.
.
<echo message="##teamcity[buildNumber '${versionNo}.${environment::get-variable('BUILD_NUMBER')}']"></echo> 

推荐答案

TeamCity具有一个内部版本号,可在运行构建脚本时将其放入环境中.

TeamCity has a build number which it places into the environment while running your build script.

您可以访问环境变量BUILD_NUMBER并将其附加到您的实际版本号.然后将其回显给TeamCity.我认为可以通过${sys.env.BUILD_NUMBER}来使用.

You can access the environment variable BUILD_NUMBER and append it to your actual version number. Then echo it back to TeamCity. I assume this would be available via ${sys.env.BUILD_NUMBER}.

所以也许:

<echo message="##teamcity[buildNumber '${versionNo}.${sys.env.BUILD_NUMBER}']"></echo> 

PS.确实没有理由像在该文章中那样更改teamcity中的内部版本号.您可以将其保留为{0}

PS. There really is no reason to change the build number in teamcity like they do in that article. You can leave it {0}

这篇关于使用文件中的计数器设置Teamcity版本号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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