TFS Build 2010: BuildNumber and DropLocation

Automatic Builds for Application Release is a current practice in every major development factory nowadays.

Using Team Foundation Server Build 2010 to accomplish this offers many opportunities to improve quality of your releases.

The following approach allow us to generate build drop folders including the BuildNumber and the Changeset or Label provided. Using this procedure we can quickly identify the generated binaries in the Drop Server with the corresponding Version.

  1. Branch the DefaultTemplate.xaml and renamed it with CustomDefaultTemplate.xaml

image

  1. Open it for edit (check out)
  2. Go to the Set Drop Location Activity and edit the DropLocation property.

image

  1. Write the following expression:

BuildDetail.DropLocationRoot + "\" + BuildDetail.BuildDefinition.Name + "\" + If(String.IsNullOrWhiteSpace(GetVersion), BuildDetail.SourceGetVersion, GetVersion) + "_" + BuildDetail.BuildNumber

  1. Check in the branched template.
  2. Now create a build definition named TestBuildForDev using the new template.

The previous expression sets the DropLocation with the following format: (ChangesetNumber|LabelName)_BuildName_BuildNumber

The first part of the folder name will be the changeset number or the label name (if triggered using labels). Folder names will be generated as following:

  1. C1850_TestBuildForDev_20111117.1 (changesets start with letter C)
  2. LLabelname_TestBuildForDev_20111117.1 (labels start with letter L)

Try launching a build from a Changeset and from a Label. You can specify a Label in the GetVersion parameter in the Queue new Build Wizard, going to the Parameters tab (for labels add the ā€œLā€ prefix):

image

3 Comments

Comments have been disabled for this content.