How to: Check Out and Edit Source-Controlled Items

Team Foundation source control functionality is manipulated within the Visual Studio environment. The following procedures describe how to check out items from Solution Explorer and Source Control Explorer in order to edit them.

Checking out items from the Command Line

Items can be checked out from the command line by using the Checkout and Edit Commands as shown in the following procedure. The Checkout Command makes a local file in your workspace writable by changing its status. The tf.exe checkout command is immediately processed.

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.

Using a checkout lock prevents other users from checking in or checking out any of the specified items until you release the lock. If any other users have 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 source 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 Source Control Workspaces.

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, ensure that the item or 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:

    • None - Allow shared checkout

    • 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 to indicate that the files are checked out to you.

    Tip

    A check mark indicates that the items are checked out with the None - Allow shared content option selected. A check mark with an exclamation point icon indicates that the items were checked out with either the Check Out - Prevent other users from checking out and checking in option or the Check In - Allow other users to check out but prevent them from checking in option selected.

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 display 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, ensure that the item or items that you want to work on display as selected and then select a locking option under the Lock section.

    Select one of the following lock options:

    • None - Allow shared content

    • 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 to indicate that the files are checked out to you.

    Tip

    A check mark indicates that the items are checked out with the None - Allow shared content option selected. A check mark with an exclamation point icon indicates that the items were checked out with either the Check Out - Prevent other users from checking out and checking in option or the Check In - Allow other users to check out but prevent them from checking in option selected.

To checkout a file from the command line

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

  2. Point to Visual Studio Tools and then click Visual Studio 2005 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

    For the full syntax available for the check in command, see Checkout and Edit Commands.

See Also

Tasks

Walkthrough: Exploring Team Foundation Source Control

Reference

Checkout and Edit Commands

Concepts

Using Source Control Explorer

Other Resources

Getting a Local Copy of Files from the Source Control Server