Tuesday, February 24, 2009

TFS team build of a specific labelled version

By default TFS Team Build retrieves the latest version sources and builds. To enable the Team Build to take a specific set of sources, you need to override the Target "GetCore".


<Target Name="CoreGet"
Condition=" '$(SkipGet)'!='true' and '$(IsDesktopBuild)'!='true' "
DependsOnTargets="$(CoreGetDependsOn)" >

<!-- Get the sources for the given workspace-->
<Get TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
Workspace="$(WorkspaceName)"
Version="$(GetVersion)"
Filespec="$(GetFilespec)"
PopulateOutput="$(GetPopulateOutput)"
Overwrite="$(GetOverwrite)"
Preview="$(PreviewGet)"
Recursive="$(RecursiveGet)"
Force="$(ForceGet)">
<Output TaskParameter="Gets" ItemName="Gets" />
<Output TaskParameter="Replaces" ItemName="Replaces" />
<Output TaskParameter="Deletes" ItemName="Deletes" />
<Output TaskParameter="Warnings" ItemName="GetWarnings" />
</Get>

<SetBuildProperties Condition=" '$(GetVersion)' != '$(SourceGetVersion)' "
TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
SourceGetVersion="$(GetVersion)" />

<PropertyGroup>
<SourceGetVersion>$(GetVersion)</SourceGetVersion>
</PropertyGroup>

</Target>


To pass the label from 'Queue New Build' dialog, enter /property:GetVersion="Llabel" in MSBuild Command-line arguments text box where 'L' specifies that it's a label.

No comments:

Post a Comment