Reset TeamCity build number nightly 0

Recently I’ve spent some time at work getting our build environment automated and setting up continuous integration using JetBrains TeamCity, which I would recommend to anyone doing the same. We use the TeamCity build number as our revision number, and since our build numbers depend on dates, we needed a good way to reset the revision number nightly.

Turns out this was super simple to do. The following Ruby script takes care of resetting the build number. On Windows, I found the build numbers for projects under %USERPROFILE%\.BuildServer\config\.

To get it to run nightly, I simply set up a scheduled task using Windows’s built in Task Scheduler application. The task runs the following batch file:

Leave a Reply