Workfold Command
Creates, modifies, or displays information about the mappings between your workspace folders and the Team Foundation version control server folders.
Required Permissions
To use the workfold command, you must be the owner of the specified or implied workspace or have the global Administer workspaces permission set to Allow. For more information, see Team Foundation Server Permissions.
tf workfold localfolder
tf workfold [/workspace:workspacename]
tf workfold [/server:servername] [/workspace:workspacename]
serverfolder
tf workfold [/map serverfolder localfolder] [/server:servername]
[/workspace:workspacename] (serverfolder|localfolder)
tf workfold /unmap [/server:servername] [/workspace:workspacename]
[/recursive] (serverfolder|localfolder)
tf workfold /cloak
(serverfolder|localfolder) [/workspace:workspacename] [/s:servername]
tf workfold /decloak (serverfolder|localfolder)
[/workspace:workspacename] [/s:servername]
Parameters
Argument |
Description |
---|---|
servername |
Specifies the name of your Team Foundation Server for the /server option. Example: teamfoundation2. |
workspacename |
Specifies the name of the workspace on which the command operates for the /workspace option. |
serverfolder |
Specifies the name of a Team Foundation version control server folder. |
localfolder |
Specifies the name of a local folder. |
Option |
Description |
---|---|
/server |
Identifies the Team Foundation Server. This option is required if the command is invoked from a directory that is not mapped to a workspace. |
/workspace |
Specifies the name of the workspace to work in. |
/map |
Specifies an association between a local folder and the Team Foundation version control server folder. By default, the workfold command uses this option, even if unspecified, unless /unmap, /cloak, or /decloak is specified. |
/unmap |
Specifies which folder mapping should be removed from the workspace. |
/cloak |
Specifies that the folder should be excluded from any version control actions made in the workspace. |
/decloak |
Decloaks a folder so the folder can be retrieved into the workspace. |
Remarks
You can use the workfold command of the tf command-line utility to create and edit workspace mappings. A workspace mapping creates a client-side folder into which all files and subfolders in the Team Foundation version control server folder are retrieved when you execute a tf get operation. This get will not work if the client-side folder is cloaked.
You can also specify an asterisk (*) wildcard to map a Team Foundation Server folder and its immediate items to your local workspace. This is often referred to as single folder mapping.
For more information on how to find the tf command-line utility, see Tf Command-Line Utility Commands.
Options for Workspace Mapping
A workspace mapping is a list of active and cloaked items. You can add Team Foundation version control server items to the mapped list in the workspace using the /map option. You can also exclude an item from the workspace explicitly by using the /cloak option. You can only cloak the items that have a mapped parent. Cloaking is an effective way to improve the speed of batch Get operations and to conserve space on disk.
Use cloaking with discretion. To avoid compilation and integration problems, you should only cloak those items that you know to be outside the scope of your current and future projects, such as images and external documentation files.
You can use the /unmap and /decloak options to selectively delete mapped and cloaked entries from the workspace mapping.
How Workspace Mappings are Applied
By default, workspace mappings are applied recursively. When you map a local folder to a Team Foundation version control server folder, the system implicitly creates a mapping between all its current and future subfolders. For example, if you map $/projects to c:\projects, subsequently add a project called $/projects/project_one, and then run a get of the workspace, Team Foundation automatically creates a local working folder named project_one in the C:\projects directory.
In this example, you can use a wildcard, "*", to map a server folder and its immediate items to your local workspace:
tf workfold $/projects/MyTeamProject/* C:\MyLocalWorkfold\MyTeamProject
In this example, you can override the automatically-created mapping between $/projects/project_one and C:\projects\project_one by using the workfold command as follows:
tf workfold $/projects/project_one C:\DifferentWorkfold
Mappings under Cloaks
Mappings of uncloaked folders that are located beneath a cloaked folder in the version control hierarchy can be mapped to your local workspace.
Examples
The following example displays the mappings for the workspace in which c:\projects resides.
c:\projects>tf workfold
The following example cloaks the c:\projects\lib folder.
c:\projects>tf workfold /cloak c:\projects\lib
The following example displays the mapping for the local file word.cs.
c:\projects>tf workfold word.cs
The following example maps the folder C:\DifferentWorkfold to the Team Foundation version control server folder $/projects/project_one and replaces the previous workspace mapping for the $/projects/project_one Team Foundation version control server folder.
c:\projects>tf workfold $/projects/project_one C:\DifferentWorkfold
See Also
Tasks
Walkthrough: Working with Team Foundation Version Control from the Command Line
How to: Cloak and Uncloak Folders in a Workspace
How to: Create a Mapped Workspace
Concepts
Working with Version Control Workspaces
Reference
Command-Line Syntax (Team System)