Share via


Work with Build Numbers

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.

Syntax for Build Number Expressions

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:

$(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)

In this case, the next completed build of DailyBuild would be set to the following build number:

DailyBuild_20090824.2

The following table shows how each token is resolved based on the previous example:

Token

Replacement value based on the example earlier in this section

$(BuildDefinitionName)

DailyBuild

$(BuildID)

4

$(DayOfMonth)

24

$(DayOfYear)

236

$(Hours)

09

$(Minutes)

50

$(Month)

08

$(Rev:.rr)

2 (The next build on this day will be 3, and so on.)

$(Date:MMddyy)

082409

$(Seconds)

50

$(TeamProject)

ContosoCore

$(Year:yy)

09

$(year:yyyy)

2009

Specify the Build Number Expression

You can specify this expression in the following ways: