How to: Apply Labels

In Team Foundation source control, a label is a name applied to a specific set of revisions.

Note

  A specific set of revisions is also known as a snapshot build.

Labels can apply to one revision of a file only. With a subsequent revision of a file, the label either must be removed or a new label must be applied. Labels are a simple way to organize a set of files in a revision. Labels have scope; for more information, see Working with Labels.

Required Permissions

To perform these procedures, you must have the Label permission set to Allow. For more information, see Team Foundation Server Permissions.

To apply a label from Source Control Explorer

  1. On the Visual Studio View menu, point to Other Windows, and then click Source Control Explorer.

    Note

    If Source Control Explorer does not appear under Other Windows, a button for it appears on the toolbar.

  2. In Source Control Explorer, locate the folder or file to which you want to apply a label, right-click on it, and then click Apply Label.

    The Choose Item Version dialog box appears.

  3. From the Choose Item Version dialog box, in the Look in box, you can browse to a different team project server folder.

    The Item name box designates the file or folder you selected.

  4. In the Items of type drop-down list, select the types of items to label.

  5. In the Choose Item Version dialog box, select the desired team project in the Look in list.

  6. Under the Items of type list, select the type of items desired.

  7. Make sure you have selected the item to which you want to apply the label, and then, in the Version list, click the version type you want:

    • To apply a label to a specific changeset, click Changeset and enter the changeset in the Changeset text box. To find a change set, click the browse button with the ellipses (…) next to the Changeset text box.

      The Find Changesets dialog box appears.

      Use the options on the Find Changesets dialog box to filter to the changeset to which you want to apply the label. For more information, see How to: Find a Changeset.

    • To apply a label based on date, click Date. In the Date text box enter a date to specify a file or folder version.

    • To apply a label based on an existing label, click Label and enter a label name in the Label text box. To find a label, click the browse button with the ellipses (…) next to the Label text box.

      The Find Label dialog box appears.

      Use the options on the Find Label dialog box to filter to the existing label to which you want to apply the new label. For more information, see How to: Find Labels.

    • To apply a label to the latest version, click Latest Version.

    • To apply a label to a workspace version, click Workspace Version. In the Workspace Version text box, type in the workspace name and the user in workspace;user format.

  8. Once you are satisfied with your settings, click OK.

    The Apply Label dialog box appears.

  9. In the Name box, type a name for the label, and then if you have any notes, add them in the Comment box.

    The Items box lists the files and folders you have chosen to apply the label to along with the existing version numbers.

  10. Under Items, either click Add to select more files or folders from the Choose Item Version dialog box to which you want to apply the same label or click OK to apply the label to the files or folders appearing in the Items text box.

To apply a label from the Visual Studio menu

  1. Select a file or folder to which you want to apply a label.

  2. From the Visual Studio File menu, point to Source Control, point to Label, and then click Apply Label.

    The Choose Item Version dialog box appears.

  3. In the Look in box, browse to a different server folder, if necessary.

    The Item name box designates the file or folder you selected.

  4. In the Items of type drop-down list, select the types of items to label.

  5. In the Choose Item Version dialog box, select the desired team project in the Look in list.

  6. Under the Items of type list, select the type of items desired.

  7. Make sure you have selected the item to which you want to apply the label, and then, in the Version list, click the version type you want:

    • To apply a label to a specific changeset, click Changeset and enter the changeset in the Changeset text box. To find a changeset, click the browse button with the ellipses (…) next to the Changeset text box.

      The Find Changesets dialog box appears.

      Use the options on the Find Changesets dialog box to filter to the changeset to which you want to apply the label. For more information, see How to: Find a Changeset.

    • To apply a label based on date, click Date. In the Date text box, enter a date to specify a file or folder version.

    • To apply a label based on an existing label, click Label and enter a label name in the Label text box. To find a label, click the browse button with the ellipses (…) next to the Label text box.

      The Find Label dialog box appears.

      Use the options on the Find Label dialog box to filter to the existing label to which you want to apply the new label. For more information, see How to: Find Labels.

    • To apply a label to the latest version, click Latest Version.

    • To apply a label to a workspace version, click Workspace Version. In the Workspace Version text box, type in the workspace name and the user in workspace;user format.

  8. Once you are satisfied with your settings, click OK.

    The Apply Label dialog box appears.

  9. In the Name box, type a name for the label, and add any notes in the Comment box.

    The Items box lists the files and folders to which you have chosen to apply the label along with the existing version numbers.

  10. Under Items, either click Add to select more files or folders from the Choose Item Version dialog box to which you want to apply the same label or click OK to apply the label to the files or folders showing in the Items text box.

To apply a label from the command line

  1. Click Start, click All Programs, point to Microsoft Visual Studio 2005, point to Visual Studio Tools, and then click Visual Studio 2005 Command Prompt.

  2. Type cd path, where path is the directory that contains the applicable workspace.

  3. Type tf label mylabel . /r.

  4. Attaches the "mylabel" label to the workspace version of the "path" folder and all the files and folders it contains.

    Note

    For a complete listing of the syntax for the label command, see Label Command (Team Foundation Source Control).

See Also

Reference

Label Command (Team Foundation Source Control)

Concepts

Working with Labels
Working with Source Control Changesets
Working with Source Control Workspaces