Search code examples
continuous-integrationbuild-processversioning

TFS Build Resets File Version When New Date


When using TFS 2010 to version builds, the date is included in the build number format (see image below). Versioning works correctly for builds on the same date; the assembly file version increments by one. However, as soon as we build on a new date, the assembly file version starts over at 1.0.0.1.

For example, here are the dates, name of build, and versions on each day:

Sep 7, MyProject_1.0_20120907.1, 1.0.0.1
Sep 7, MyProject_1.0_20120907.2, 1.0.0.2
Sep 7, MyProject_1.0_20120907.3, 1.0.0.3
Sep 8, MyProject_1.0_20120908.1, 1.0.0.1 <= Resets to 1.0.0.1 (I want 1.0.0.4)

Is there an easy way to keep the file version incrementing regardless of the date it was built?

enter image description here

-- Edit --

Based on the macro list, it doesn't appear that this is possible. Unless someone can answer otherwise, I'll post an answer that this isn't possible.


Solution

  • I typically include the date in my assembly versions, for example: 2.1.1209.1907 this would be the 7th build of the day on Sep 19, 2012 (the 2.1 part I manually control).

    Another option is to simply remove the date portion from the Build Number Format, then the revision will increment indefinitely. E.g. $(BuildDefinitionName)_$(Rev:.r)