Share via


Label Task

The Label task attaches a label to the latest version of the files in the workspace.

Parameters

Parameter

Description

TeamFoundationServerUrl

Specifies the URL of the server that is running Visual Studio Team System Team Foundation Server (for example, http://MyServer:8080).

BuildUri

Specifies the build uniform resource identifier (URI).

Name

Specifies the label name. By default, the name of the label created by Team Foundation Build is the same as the BuildNumber property.

Override LabelName property in the TFSBuild.proj file to specify a different label name.

Scope

Specifies the scope of the label that is being created. This parameter has the same effect as the @scope argument of the tf label command. For more information, see Label Command (Team Foundation Version Control).

Version

Specifies the version of the file or folder.

By default, Team Foundation Build labels the entire contents of the workspace specified by WorkspaceName property.

Override LabelVersion property to specify a different versionspec. This corresponds to the versionspec parameter of tf.exe label command. For more information, see Label Command (Team Foundation Version Control).

Files

Specifies the items to be labeled.

By default, Team Foundation Build replaces the version of items that already exist in its label. This corresponds to a value of replace for the /child option for tf.exe label command.

Set LabelFiles property to merge in TFSBuild.proj file to not to change items within an existing label.

Child

By default, Team Foundation Build replaces the version of items that already exist in its label.

Set LabelChild property to merge in TFSBuild.proj file to leave the items within an existing label unchanged.

This corresponds to the /child option of tf.exe label command.

Comments

Specifies the comment used for the label by Team Foundation Build.

The default comment created by Team Foundation Build is "Label created by Team Build."

Override the LabelComment property in the TFSBuild.proj file to specify a different comment.

Recursive

Specifies whether the files are labeled recursively. This corresponds to the /recursive option for tf.exe label command.

Set LabelRecursive property to false in TFSBuild.proj file. This action labels just the top-level items.

Remarks

The Label task is defined in the Microsoft.TeamFoundation.Build.Tasks.VersionControl.dll. The Microsoft.TeamFoundation.Build.targets file contains an instance of the Label task that Team Foundation Build uses as a default implementation for the CoreLabel 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 Label task defined in the Microsoft.TeamFoundation.Build.targets file.

<Label

              TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
              BuildUri="$(BuildURI)"
              Name="$(LabelName)"
              Scope="$(LabelScope)"
              Version="$(LabelVersion)"
              Files="$(LabelFiles)"
              Child="$(LabelChild)"
              Comments="$(LabelComment)"
              Recursive="$(LabelRecursive)" />

See Also

Tasks

How to: Customize Build Numbers

Concepts

Team Foundation Build Tasks

Reference

Label Command (Team Foundation Version Control)

Other Resources

Customizing Team Foundation Build

Team Foundation Build Targets, Tasks, and Properties