Setting TeamCity variables from build

I stumbled upon a useful feature of TeamCity today. The ability to set TeamCity variables from your build. This can be useful for instance if you create a version number in your build which you wish to use as the build number or label for VCS inside TeamCity.

All you need to do is output a message in a particular format. Here is an example of setting the build number in MSBUILD to the value of a property.

<Message Text="##teamcity[buildNumber '$(AssemblyVersionString)']" />

After this has run in your build, the value of the TeamCity variable %system.build.number% will now be assigned the value of  AssemblyVersionString.

Advertisements
Tagged ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: