View command (Team Foundation Version Control)
Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019 | TFS 2018
Visual Studio 2019 | Visual Studio 2022
The Team Foundation Version Control (TFVC)
view command retrieves a specific version of a file, stores it in a temporary folder on your computer, and displays it.
To use the
view command, you must have the Read permission set to Allow. For more information, see Default TFVC permissions.
tf view [/collection:<team-project-collection-url>] [/console] [/recursive] [/output:<local-file>] [/shelveset:<shelveset-name>[;<owner>]] [/noprompt] <item-spec> [/version:<version-spec>] [/login:<username>,[<password>]]
The following sections describe arguments and options of the
Provides the URL of the project collection that contains a specific version of a file that you want to retrieve information about, for example,
Identifies the shelveset. The optional
<owner> argument is used to specify a shelveset that's not owned by the current user.
Identifies the file or folder to retrieve. For more information about how TFVC parses the
<item-spec> argument to determine which items are within scope, see Use Team Foundation version control commands - Use options to modify how a command functions.
You can specify more than one
Provides a value such as C3 for the
/version option. For more information about how TFVC parses a version specification to determine which items are within its scope, see Use Team Foundation version control commands.
Provides a value to the
/login option. You can specify this value as either
Provides a value to the
Provides the path to the output file folder.
Specifies that the file output should be directed to the console. This option is useful if you want to write the file to disk by using console redirection but use a different name or location than the versioned item.
Views all items in the specified directory and any subdirectories.
Specifies the shelveset by name.
Specifies that TFVC shouldn't prompt you before displaying each file when you include a wildcard expression in an
<item-spec> argument that matches more than one file.
Specifies the version of the file to open for viewing. If you omit this option,
view retrieves the latest Azure DevOps server version.
Specifies the project collection.
Specifies the username and password to authenticate the user with Azure DevOps.
Outputs the file to a local folder instead of invoking a Windows shell to open the file.
view command of the
tf command-line utility retrieves a read-only copy of a file from the Azure DevOps server, stores the file in a temporary folder on your computer, and displays the file contents. Unless you specify a particular version, TFVC retrieves the latest version of the file from the Azure DevOps server.
view command doesn't add files to your workspace or check them out. For more information about how to get the Azure DevOps server version of a file and check it out, see Get command and Checkout and Edit commands.
You can use the
difference command to view the differences between two versions of a file. For more information, see Difference command.
For more information about how to use the
tf command-line utility, see Use Team Foundation version control commands.
By default, TFVC displays the contents of the file in the viewer that's associated with its file type.
If you include the
/consoleoption, TFVC prints the contents of the file to the command console. Likewise, if TFVC can't locate a viewer for the type of file that you specified, it prints the file contents to the command console.
You can redirect the contents of a file to standard output by using
\>. This option provides a way to save the file to another file or pass it to another program for post-processing.
The following example displays the latest version of the file 314.cs:
c:\projects>tf view 314.cs
The following example displays the version of 314.cs that was checked in with changeset 1999:
c:\projects>tf view /version:C1999 314.cs
The following example retrieves version 5 of 314.cs and writes it to the file 314.old:
c:\projects>tf view /version:5 314.cs > 314.old
The following example displays the latest version of each file that matches the wildcard expression *.cs:
c:\projects>tf view *.cs
Submit and view feedback for