Version numbering - same version number between TeamCity builds and local developer builds?


We are using TeamCity to automate the build of our Delphi applications.

Our applications can be built either by:
1) A TeamCity build agent, or
2) Individual developers, on their own development PCs.

We want to keep the build numbers in sync between the build agents and the dev PCs, so that when devs produce a build from their machine, it has the same build number as it would have off the build agent.

To accomplish this, we've implemented a strategy of keeping the version numbers in a version-controlled file (we're using Subversion).
Since the source code on the build agent isn't actually a Subversion client workspace, we've setup a small Subversion client workspace on the build agent, which just contains the version number files.
When a build occurs on a build agent, the last thing the build script does is to increment the number in the version-number file, then check that into subversion.
Developers can then just "get latest" to get the correct version number.

The problem comes when we create a branch, and setup a new build configuration for that branch in TeamCity. Currently we have to create a new Subversion client workspace manually on the build agent, just to hold the version number files for that branch, just so that we can increment the version number & submit after a successful build.

I know we could simplify the setup by using TeamCity's built-in BUILD_NUMBER environment variable. That would allow us to remove the Subversion client workspace on the build agent. However, then the dev PCs wouldn't know the build number (since they're not TeamCity agents & wouldn't have the BUILD_NUMBER environment variable).

Any suggestions?




Hello Darren,

You can use agent-side checkout for Subversion. In this mode build's sources will be stored in svn working copy  on agent and commit operations can be performed.

Kind regards,


Great, thanks - I didn't know the build agents can be full-fledged SVN clients, I'll give that a try.




Please sign in to leave a comment.