TFS- Controlling Labelling

TFS does a great job of automating build. With out having to mess with msbuild , it will pull all the source code from source control, do the build label the build in source control etc. In our scenario we did not want TFS to label each and every build, but only builds that were of production quality. To turn off labelling in TFS build set the property SkipLabel to true like below

<SkipLabel>true</SkipLabel>

We also have the option to override the label that TFS puts in. By default it looks something like this

[Name of build definition]_yyyymmdd.[running number of build for that day]

To override the default label, go ahead and add a Target called BeforeLabel and set the property for LabelName and LabelComment(Comments are optional, but its always good to have them ;-)  . In our case , in the comments we add the information about who triggered the build, from which machine and at what time just for posterity sake

<Target Name ="BeforeLabel" >

<Message Text="----Creating a source control label-----"></Message>

<CreateProperty Value ="Version-$(Version)">

<Output PropertyName ="LabelName" TaskParameter="Value"/>

</CreateProperty>

<CreateProperty Value ="Release Build Version -$(Version) at $(StartTime) initiated by $(RequestedBy) from $(MachineName)">

<Output PropertyName ="LabelComment" TaskParameter="Value"/> </CreateProperty>

</Target>

No Comments