Get Task

The Get task retrieves a read-only copy of the files and folders in a workspace by using specified options.

Parameters

Parameter

Description

BuildUri

Specifies the build URI.

Workspace

Specifies the workspace name.

Version

Specifies the file versionspec. By default the versionspec used is T, or the latest version. Set the GetVersion property in TFSBuild.proj file to get a different version. This behavior corresponds to the /version option of tf.exe get command. For more information, see Get Command.

Filespec

Specifies the items in the workspace. By default, Team Foundation Build gets all items in the workspace specified by the WorkspaceName property. Override the GetFileSpec property in TFSBuild.proj file to specify a specific Itemspec. This corresponds to the Itemspec parameter of tf.exe get command.

PopulateOutput

By default, Team Foundation Build does not return the list of items that were retrieved, replaced, or deleted, nor does it return warnings generated by the Get task. Set the GetPopulateOutput property to true in TFSBuld.proj file to make these lists available. When you set GetPopulateOutput to true, this is what you will get:

  • Retrieved items in an item group called Gets

  • Replaced items in an item group called Replaces

  • Deleted items in an item group called Deletes

  • Warnings in an item group called GetWarnings

Preview

Specifies whether to display what would occur without actually performing the Get operation. Set PreviewGet to true in TFSBuild.proj file to preview the Get operation. This corresponds to the /preview option of tf.exe get command.

Recursive

Specifies whether files are retrieved recursively. Set the RecursiveGet property to false in the TfsBuild.proj file to do a non-recursive get in a Team Foundation Build project. This corresponds to the /recursive option of tf.exe get command.

Force

Specifies whether the files are retrieved incrementally. To do an incremental get in a Team Foundation Build definition, set the ForceGet property to false in the TfsBuild.proj file. Corresponds to the /force option of tf.exe get command.

Gets

Output parameter. Specifies the list of items that were retrieved by the Get task.

Replaces

Output parameter. Specifies the list of items that were replaced by the Get task

Deletes

Output parameter. Specifies the list of items that were deleted by the Get task

Warnings

Output parameter. Specifies the list of warnings that were generated by the Get task

Remarks

The Get task is defined in the Microsoft.TeamFoundation.Build.Tasks.VersionControl.dll. The Microsoft.TeamFoundation.Build.targets file contains an instance of the Get task that Team Foundation Build uses as a default implementation for the CoreGet target.

The <root>:\Program Files\MSBuild\Microsoft\VisualStudio\TeamBuild folder on the Team Foundation Build computer contains the Microsoft.TeamFoundation.Build.targets file.

Example

The following example shows the default instance of Get task defined in the Microsoft.TeamFoundation.Build.targets file.

<Get 
    TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
    BuildUri="$(BuildURI)"
    Workspace="$(WorkspaceName)"
    Version="$(GetVersion)"
    Filespec="$(GetFilespec)"
    PopulateOutput="$(GetPopulateOutput)" 
    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>

See Also

Tasks

How to: Customize Build Numbers

Concepts

Team Foundation Build Tasks

Reference

Get Command

Other Resources

Customizing Team Foundation Build

Team Foundation Build Targets, Tasks, and Properties