How to: Create a Workspace

To begin working with Team Foundation source control, you need to establish a workspace. A workspace is a local copy of the files and folders in the server. When you add, edit, delete, move, rename, or otherwise change any source-controlled item, your changes are isolated in your workspace where you can safely build and test your changes. It is only when you perform a check-in operation that these changes are committed to the server and available outside of your workspace.

A workspace consists of a series of working folder mappings. Each mapping associates a folder in the server with a local folder on disk. To get a local copy of the files on the server, create a new workspace, specify the mappings for the workspace, and then use the get command to populate your workspace with source files. For more information about how to change the mapping for individual workspace folders, see Workfold Command.

Team Foundation stores information about workspaces, including a list of all files retrieved into the workspace, the version that was retrieved, and a list of pending changes. Because this information is stored on the server, any other users with the correct permissions can duplicate your working environment on their computers, minus any pending changes. For more information, see Get Command.

Mapping Local Folders to Source Control Server Folders

A workspace mapping establishes a client-side working folder into which all files and subfolders in a specified server folder are retrieved when you perform a Get operation. You can also provide a cloak mapping, which will prevent files and subfolders in the specified server folder from being retrieved when you perform a Get operation. You can establish workspace mappings manually in the Create Workspace dialog box during the workspace creation process, or they will be created for you automatically by Team Foundation when you add files to source control. For more information, see Working with Source Control Workspaces.

Before you can perform Team Foundation source control commands on your computer, you must have a workspace. The following procedures demonstrate creating a workspace from Visual Studio Team Foundation Server and from the command line.

You can see all of the workspaces that you have created on the current computer by typing tf workspaces at the command prompt. For more information, see Workspaces Command.

Required Permissions

To perform these procedures, you must have the Create a workspace or the Administer workspaces permission set to Allow. For more information, see Team Foundation Server Permissions.

To create a workspace to manage your source-controlled files

  1. From the File menu, select Source Control, and then click Workspaces.

  2. In the Manage Workspaces dialog box, click Add.

  3. Type a descriptive name in the Name box, enter a comment describing the new workspace in the Comment box, and provide alternative Owner and Computer name values, as necessary.

  4. Under Working Folders, in the Source Control Folder box, click the text box and then the ellipsis ().

  5. In the Browse for Folder dialog box, select a server folder, and then click OK.

  6. Under Working Folders, in the Local Folder box, click the text box, and then click the ellipsis ().

  7. In the Browse for Folder dialog box, select a folder on your computer, and then click OK.

  8. In the Add Workspace dialog box, click OK to create the workspace.

  9. In the Manage Workspaces dialog box, click Close.

    Tip

    With the workspace established, right-click the project folder that has the source files that you want to get, and use the Get Latest Version command to populate your workspace with source from the server.

To create a workspace to manage your source-controlled files 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 Command Prompt.

  2. Type mkdir path, where path is the location of a directory in which to store your personal copy of the files in the server (for example, c:\projects).

  3. Type cd path, where path is the directory that you just created.

  4. Type tf workspace /new /s:servername, where servername is the name of your Team Foundation Server (for example, team1server), and then press ENTER.

  5. In the Add Workspace dialog box, with the Name box filled in correctly, click OK.

See Also

Tasks

How to: Cloak and Decloak Folders in a Workspace

Reference

Workspace Command
Workfold Command

Concepts

Working with Source Control Workspaces