TeamBuild implemented ‘Get’ task for syncing sources. This task is same as ‘tf get’, the command line utility to sync sources.
Properties Supported by Get Task
The workspace used to get sources
You can specify a version by:
by default, it is ‘T’, get latest sources.
items that need to be fetched. It is ‘*’, by default
Recursively retrieves all items that match your filespec
The default build type uses this task to get the latest sources. However, you can very easily customize Get task to sync what you want. To do this, you will need to override the CoreGet target implemented in TeamBuild targets file Microsoft.TeamFoundation.Build.targets. I typically copy a target that I want to override into TfsBuild.proj of my build type and make changes appropriately. In this case, I copied CoreGet target into my TfsBuild.proj and played with it. I’m providing some examples below. This is a very powerful task. You can use the options Version and FileSpec in conjuction to get any sources of any version.
of any version.
Getting Labled Sources
The following example gets the sources labeled with “Beta1” and builds.
Condition=" '$(IsDesktopBuild)'!='true' "
Condition=" '$(SkipGet)'!='true' "
<!-- Label all files in the workspace to identify sources used in this build -->
Condition=" '$(SkipLabel)'!='true' "
Getting a Particular Changeset into TeamBuild
The following example gets the sources labeled with “Beta1” and gets Porgram.cs that was checked in with changeset 26.