How to: Check Out and Edit Version-Controlled Items

You can get version-controlled items from the server and populate them into your local workspace for your team project by using Solution Explorer, Source Control Explorer, or the command line. If you use Solution Explorer or Source Control Explorer, you can use a checkout lock to keep other users from checking in or checking out any of the specified items until you release the lock. If another user has locked any of the specified items, the lock operation fails. For more information, see How to: Lock and Unlock Folders or Files.

Note

Before you can perform Team Foundation version control commands on your computer, you must create a workspace that can be populated with files from the server. For more information, see Working with Version Control Workspaces.

The following procedures demonstrate how to check out items from Solution Explorer, Source Control Explorer, and the command line so you can modify them.

Required Permissions

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

To check out an item for edit from Solution Explorer

  1. In Solution Explorer, highlight the item or items that you want to work on. Items that are currently checked in are designated in Solution Explorer with padlock icons. Right-click and click Check Out for Edit.

    The Check Out dialog box appears.

  2. In the Check Out dialog box, be sure that the items that you want to work on are selected with a check mark in their respective check boxes, and then select a locking option under the Lock section. The choices are:

    • Unchanged - Keep any existing lock

    • None - Allow shared checkout

      **(**Not for use with the Service Pack 1 version of Microsoft Visual Studio Team System 2008 Team Foundation Server.)

    • Check Out - Prevent other users from checking out and checking in

    • Check In - Allow other users to check out but prevent them from checking in

  3. Click Check Out.

    Solution Explorer replaces the padlock icon with a check mark icon. This indicates the files are checked out to you.

    Note

    The results of this command are not reflected in the server until you perform a check-in operation. For more information, see How to: Check In Pending Changes.

To check out an item for edit from Source Control Explorer

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

  2. In Source Control Explorer, expand the team project folder that contains the solution or project file that you want to work on.

    All the files associated with the team project appear in the affiliated file listing.

  3. In the file listings, right-click the file or files that you want to check out and click Check Out for Edit.

  4. In the Check Out dialog box, be sure that the items that you want to work on appear as selected, and then select a locking option under the Lock section.

    Select one of the following lock options:

    • Unchanged - Keep any existing lock

    • None - Allow shared checkout

      **(**Not for use with the Service Pack 1 version of Microsoft Visual Studio Team System 2008 Team Foundation Server.)

    • Check Out - Prevent other users from checking out and checking in

    • Check In - Allow other users to check out but prevent them from checking in

  5. Click Check Out.

    Solution Explorer replaces the padlock icon with a check mark. This indicates the files are checked out to you.

    Note

    The results of this command are not reflected in the server until you perform a check-in operation. For more information, see How to: Check In Pending Changes.

To check out a file from the command line

  1. Click Start, click All Programs, and then point to Microsoft Visual Studio 2008.

  2. Point to Visual Studio Tools and then click Visual Studio 2008 Command Prompt.

  3. Type cd path, where path is the location of the directory used to store your personal copy of the files in the server, for example, c:\projects.

  4. Type tf.exe checkout /lock:Checkout file name and then press ENTER.

    Note

    The results of this command are not reflected in the server until you perform a check-in operation. For more information, see Checkin Command. For the full syntax available for the check in command, see Checkout and Edit Commands.

See Also

Tasks

Walkthrough: Exploring Team Foundation Version Control

Concepts

Using Source Control Explorer

Reference

Checkout and Edit Commands

Other Resources

Getting a Local Copy of Files from the Version Control Server