Work with Build Numbers
Updated: May 2011
You can define your build process to load useful data into the name of each completed build. For example, the default build process (as defined in DefaultTemplate.xaml) loads the following information into the name of the completed build:
the name of the build definition
the date on which the build was run
an integer that is incremented by one every time that the build definition is repeated on a given date
As a result, a completed build name could resemble this example: DailyBuild_20090824.2.
You specify how completed builds are named by using an expression. Consider the following example:
The team project is named ContosoCore.
The build definition is named DailyBuild.
The build ID is 4.
Today is August 24, 2009.
The time is 9:50:43 PM.
The build has been run one time today.
You could set the BuildNumberFormat property to the following value:
In this case, the next completed build of DailyBuild would be set to the following build number:
The following table shows how each token is resolved based on the previous example:
Replacement value based on the example earlier in this section
2 (The next build on this day will be 3, and so on.)
You can specify this expression in the following ways:
Define a DefaultTemplate.xaml build definition, and modify the Build Number Format build process parameter.
For more information, see Define a Build Using the Default Template.
Develop a custom build process template, and use the UpdateBuildNumber activity.
For more information, see Team Foundation Build Activities: UpdateBuildNumber.