共用方式為


Download (get) files from the Server

TFS 2017 | TFS 2015 | TFS 2013

Visual Studio 2019 | Visual Studio 2017 | Visual Studio 2015 | Visual Studio 2013

In general, you should get the latest files from the server on a regular basis so that the code you develop is compatible with the code developed by others on your team and to minimize the risk of creating bugs when you check in your code. You can download the latest version or a previous version of one or more files from your Team Foundation Server to your workspace on your dev machine.

Prerequisites

You must be one of the Contributors for your project. To learn more, see Default TFVC permissions.

Get the latest version of some files

You should get the latest files from your server after you set up your dev machine. Then you can begin developing your app.

Later, as you develop functionality in the workspace on your dev machine, your code is isolated from the changes that are made by other developers. But when you are ready (for example, you have completed and checked in the code that completes a task), you should get the latest version of your team's files.

To get the latest version of some files

  • In Solution Explorer or Source Control Explorer, browse to the files or the folders that contain the files that you want to get, select them, open their shortcut menu, and choose Get Latest Version.

Get a specific version of some files

In special cases (for example, to fix a regression bug), you might need to get and work with a specific version of one or more files.

Note

Keep in mind that if you get an older version of a file, make changes to it, and then try to check it in, there is an increased chance that you will need to resolve conflicts before you can complete the check-in.

To get a specific version of some files from the History window

  1. In Solution Explorer or Source Control Explorer, browse to the folder or file, open its shortcut menu, and choose View History.

  2. In the History window, open the shortcut menu of a version and choose Get This Version.

To get a specific version of some files from Solution Explorer or Source Control Explorer

  1. In Solution Explorer or Source Control Explorer, browse to the files or the folders that contain the files you want to get, select them, open their shortcut menu, and choose Get Specific Version.

    The Get dialog box appears.

  2. Choose an option from the Type drop-down list:

  3. (Optional) Select the Overwrite writable files that are not checked out option.

    If selected, files from the server will overwrite all files that do not have the read-only attribute associated with them and are not checked out. Only files on the server, which are different, will overwrite the files in the local workspace. By default, this option is not selected.

    Tip

    This option is equivalent to running the following command: tf get /overwrite.

  4. (Optional) Select the Overwrite all files even if the local version matches the specified version option.

    If selected, files from the server overwrite all files.

    Tip

    This option is equivalent to running the following command: tf get /force.

  5. Choose Get.

    Source Control Explorer appears. If you chose Latest Version in step 5, the system updates the Latest column with the status of Yes.

Work from the command prompt

Tips

  • Tip When you get files and folders from the server, the system also deletes any checked-in files from your local workspace that have been deleted from the server. Files that have been renamed or moved on the server are changed in your workspace to match the changes on the server.

  • Tip In Source Control Explorer you can verify whether you have the latest version of a file in the Latest column. You can see specific version information about an item by opening its shortcut menu and choosing Properties.

  • Tip If you are using a server workspace, and you have accidentally deleted some files that you want to restore, you must use the tf get /all command to restore the deleted files.