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.
- Branch the DefaultTemplate.xaml and renamed it with CustomDefaultTemplate.xaml
- Open it for edit (check out)
- Go to the Set Drop Location Activity and edit the DropLocation property.
- Write the following expression:
BuildDetail.DropLocationRoot + "\" + BuildDetail.BuildDefinition.Name + "\" + If(String.IsNullOrWhiteSpace(GetVersion), BuildDetail.SourceGetVersion, GetVersion) + "_" + BuildDetail.BuildNumber
- Check in the branched template.
- 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:
- C1850_TestBuildForDev_20111117.1 (changesets start with letter C)
- 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):