Udostępnij za pośrednictwem


Workspace Command

Lets you create, delete, view, or modify properties and mappings associated with a workspace.

Required Permissions

To modify or delete an existing workspace, you must be the owner or have the global Administer workspaces permission set to Allow. To create a workspace, you must have the global Create a workspace permission set to Allow. To create workspaces for other users, you must have the Administer workspaces permission set to Allow. For more information, see Team Foundation Server Permissions.

tf workspace /new [/noprompt] [/template:workspacename[;workspaceowner]]
 [/computer:computername] [/comment:("comment"|@comment file)]
 [/s:servername] [workspacename[;workspaceowner]]

tf workspace /delete [/server:servername] workspacename[;workspaceowner]

tf workspace [/server:servername] [/comment: ("comment"|@comment file)] [/newname:workspacename]
 [workspacename[;workspaceowner]]

Parameters

Argument

Description

workspacename

Specifies a name for the workspace which to create, edit, delete, or display information about.

workspaceowner

Specifies a username for the workspace. This parameter is required when the workspace owner is not the person performing the command.

computername

Provides a value to the /computer option.

comment

Provides a value to the /comment option.

@commentfile

Specifies the path of a file where the comment should be read.

servername

The user-provided value for the /server option. For example, teamfoundation2.

Option

Description

/new

Creates a new workspace.

/template

Specifies an existing workspace to use as a template to create the new workspace. The new workspace uses the mappings of the existing workspace.

/delete

Deletes the specified workspace.

/computer

Specifies the name of the computer on which to create the workspace. This option is an advanced option.

/comment

Provides a comment describing the workspace.

/server

Identifies the Team Foundation Server. This option is required when you create a new workspace and when you try to start the workspace command from a directory that is not mapped to a workspace.

/newname

Renames an existing workspace.

/noprompt

Performs the specified workspace command without displaying a dialog box.

Remarks

A workspace is a local copy of the files and folders on the server, plus any changes that you have made locally. When you add, edit, delete, move, rename, or otherwise change any version-controlled item, your changes are isolated in your workspace where you can make and test your changes. Your pending changes are committed to the server and become available to other users outside your workspace when you perform a check-in.

For more information on how to find the tf command-line utility, see Tf Command-Line Utility Commands.

Creating a new workspace

Before you can add files to the version control server or check out items on the server in order to edit them, you must create a workspace or associate an existing one with the current directory. For more information, see How to: Create a Mapped Workspace.

To make the current directory a working folder for an existing workspace on your computer, type tf workspaceworkspacename, where workspacename is the name of the existing workspace. The Edit Workspace dialog box appears. Click click here to enter a new working folder, type the server path for which you want to map the current directory in the Source Control Folder box, type the current directory in the Local Folder box, and click OK.

When you create a new workspace, you can specify a template workspace as part of the /new option. When you specify a template workspace, Team Foundation creates a new workspace on the current computer, sets the owner to the current owner, and replicates the following workspace properties into the new workspace from the template workspace: mappings and comment. If no name is specified, the system uses a name based on the current computer name. When you create a workspace using a template, Team Foundation does not retrieve the files to which it maps from the server. Use the Get Command to synchronize the new workspace with the latest version on the server.

Single Folder Mapping

You can choose to map only the immediate children of a version control folder to a local workspace. To do this, add an asterisk wild-card character in the Source Control Folder box in the Add Workspace dialog box. For example, $/folder/*. Otherwise, by default, all the children of the version control folder are recursively mapped to the local workspace.

Single folder mapping within a version control hierarchy is useful because it limits the number of items downloaded to the client computer. Another way to limit downloaded files is to cloak files that you do not need to have in your workspace. For more information, see How to: Cloak and Uncloak Folders in a Workspace. This provides faster download times and saves disk space on the client computer.

Deleting a Workspace

If you delete a workspace that contains pending changes, Team Foundation cancels the pending changes as part of the delete process. Deleting a workspace does not delete the files and folders on the client computer that were in that workspace.

Editing a Workspace

You can change the following workspace attributes:

  • Workspace Name

  • Comment

  • Working folder mappings

If no workspace specification is provided, the workspace for the current folder is used.

Examples

The following example opens the Add Workspace dialog box and creates a new workspace. You can use the Add Workspace dialog box to edit the source control folder, owner, computer, comment, and local folders.

c:\projects>tf workspace /new /server:teamserver2

The following example creates a new workspace called Beta1 and assigns jenh as the workspace owner. You must have the AdminWorkspaces permission to assign ownership of a new workspace to another user. For more information on security permissions, see Team Foundation Server Permissions.

c:\projects>tf workspace /new Beta1;jenh

The following example creates a new workspace by using the Beta1 workspace that is owned by jenh as a template.

c:\projects>tf workspace /new /template:Beta1;jenh /server:teamserver2

The following example removes the Beta1 workspace from the system.

c:\projects>tf workspace /delete Beta1

The following example edits properties for the current workspace.

c:\projects>tf workspace

The following example opens the Beta1 workspace for which user jenh is the owner so that you can see its properties and mappings. If you have the AdminWorkspaces permissions, you can change the workspace properties and mappings.

c:\projects> tf workspace Beta1;jenh

See Also

Tasks

Walkthrough: Working with Team Foundation Version Control from the Command Line

How to: Create a Mapped Workspace

How to: Cloak and Uncloak Folders in a Workspace

Concepts

Working with Version Control Workspaces

Reference

Command-Line Syntax (Team System)

Workspaces Command

Other Resources

Tf Command-Line Utility Commands