Question

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> 

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> 

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 ?

Update

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> 
Was it helpful?

Solution

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

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}.

So perhaps:

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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top