แก้ไข

แชร์ผ่าน


Workfold command (Team Foundation Version Control)

Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019

Visual Studio 2019 | Visual Studio 2022

The Team Foundation Version Control (TFVC) workfold command creates, modifies, or displays information about the mappings between your workspace folders and the folders that are on the Azure DevOps server for TFVC.

Prerequisites

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 Default TFVC permissions.

Syntax

tf workfold <local-folder> [/login:<username>,[<password>]]
tf workfold [/workspace:<workspace-name>] [/login:<username>,[<password>]]
tf workfold [/collection:<team-project-collection-url>] [/workspace:<workspace-name>] [/login:<username>,[<password>]]
<server-folder>
tf workfold [/map <server-folder> <local-folder>] [/collection:<team-project-collection-url>] 
[/workspace:<workspace-name>][/login:<username>,[<password>]
tf workfold /unmap [/collection:<team-project-collection-url>] [/workspace:<workspace-name>] 
[/recursive] (<server-folder>|<local-folder>) [/login:<username>,[<password>]]
tf workfold /cloak 
<server-folder> [/workspace:<workspace-name>] [/collection:<team-project-collection-url>] [/login:<username>,[<password>]]
tf workfold /decloak <server-folder>
[/workspace:<workspace-name>] [/collection:<team-project-collection-url>][/login:<username>,[<password>]]

Parameters

The following sections describe arguments and options of the workfold command.

Arguments

Argument

Description

<workspace-name>

Specifies the name of the workspace that the command operates on with the /workspace option.

<server-folder>

Specifies the name of an Azure DevOps server folder.

<local-folder>

Specifies the name of a local folder.

<team-project-collection-url>

The URL of the project collection that contains the folders that you want to compare with server folders, for example, https://myserver:8080/tfs/DefaultCollection/.

<username>

Provides a value to the /login option. You can specify this value as either DOMAIN\<username> or <username>.

<password>

Provides a value to the /login option.

Options

Option

Description

/workspace

Specifies the name of the workspace to work in.

/map

Specifies an association between a local folder and the Azure DevOps 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 to remove from the workspace.

/cloak

Specifies that the folder should be excluded from any version control actions that are made in the workspace.

/decloak

Decloaks a folder so that the folder can be retrieved into the workspace.

/collection

Specifies the project collection.

/login

Specifies the username and password to authenticate the user with Azure DevOps.

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 Azure DevOps server folder are retrieved when you run a tf get operation. The get operation doesn't work if the client-side folder is cloaked.

You can also use an asterisk (*) wildcard character to map an Azure DevOps Server folder and its immediate items to your local workspace. This mapping is often referred to as a single folder mapping.

For more information about how to use the tf command-line utility, see Use Team Foundation version control commands.

Options for workspace mapping

A workspace mapping is a list of active and cloaked items. You can add Azure DevOps server items to the mapped list in the workspace by using the /map option. You can also exclude an item from the workspace explicitly by using the /cloak option. You can only cloak 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 an Azure DevOps server folder, the system implicitly creates a mapping between all its current and future subfolders.

For example, suppose you map $/projects to C:\projects. Next, you add a project called $/projects/project_one, and then you run the get command on the workspace. In this scenario, TFVC automatically creates a local working folder named project_one in the C:\projects directory.

The following example uses an asterisk (*) wildcard character to map a server folder and its immediate items to your local workspace:

tf workfold $/projects/MyTeamProject/* C:\MyLocalWorkfold\MyTeamProject

The following example uses the workfold command to override the mapping that's automatically created between $/projects/project_one and C:\projects\project_one:

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 that c:\projects resides in:

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 Azure DevOps server folder $/projects/project_one and replaces the previous workspace mapping for the $/projects/project_one Azure DevOps server folder:

c:\projects>tf workfold $/projects/project_one C:\DifferentWorkfold