Dela via


How to: Apply Labels

In Team Foundation version control, a label is a name that you can apply to organize a specific set of revisions. Labels have scope; for more information, see Working with Labels.

Note

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

You can apply a label to only one revision of a file. If the file is revised after you apply the label, you must either remove the label or apply a different one.

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 View menu, point to Other Windows, and then click Source Control Explorer.

    Note

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

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

    The Choose Item Version dialog box appears.

  3. In the Items of type list, click the types of items to label.

  4. In the Choose Item Version dialog box, in the Look in list, click the appropriate team project.

    The Item name box designates the file or folder that you specified.

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

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

      The Find Changesets dialog box appears.

      Use the options in the Find Changesets dialog box to filter the list so that you can find 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 box, type a date to specify a file or folder version.

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

      The Find Label dialog box appears.

      Use the options in the Find Label dialog box to filter the list of labels so that you can find 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 most recent version, click Latest Version.

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

  6. When you are satisfied with your settings, click OK.

    The Apply Label dialog box appears.

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

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

  8. (Optional) Under Items, click Add to open the Choose Item Version dialog box, and select the files or folders to which you want to apply the same label.

  9. Click OK to apply the label to the files or folders that appear in the Items box.

To apply a label from the Visual Studio menu

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

  2. On the File menu, point to Source Control, point to Label, and then click Apply Label.

    The Choose Item Version dialog box appears.

  3. In the Items of type list, click the types of items to label.

  4. In the Choose Item Version dialog box, in the Look in list, click the appropriate team project.

  5. The Item name box designates the file or folder that you specified.

  6. 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 Browse.

      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.

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

    The Apply Label dialog box appears.

  8. 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.

  9. (Optional) Under Items, click Add to select more files or folders from the Choose Item Version dialog box to which you want to apply the same label.

  10. 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 2008, point to Visual Studio Tools, and then click Visual Studio 2008 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 Version Control).

See Also

Concepts

Working with Labels

Working with Version Control Changesets

Working with Version Control Workspaces

Reference

Label Command (Team Foundation Version Control)