连接到团队资源管理器中的项目

团队资源管理器将 Visual Studio 2019 及早期版本连接到 Team Foundation 版本控制 (TFVC) 存储库以及 Azure DevOps Services 或本地 Azure DevOps Server(以前称为 Team Foundation Server (TFS))上托管的项目。 你可管理源代码、工作项和生成。

重要

在 Visual Studio 2019 版本 16.8 中,默认启用 Git 版本控制体验。 若要详细了解它如何与团队资源管理器进行比较,请参阅 Git 和团队资源管理器的并行比较页。

不过,如果更希望继续在 Visual Studio 2019 中使用团队资源管理器,则转到“工具”>“选项”>“环境”>“预览功能”,然后切换“新的 Git 用户体验”复选框。 (此选项不适用于 Visual Studio 2022 及更高版本。)

使用团队资源管理器连接到项目的方式取决于你使用的 Visual Studio 2019 的版本。

在 Visual Studio 2019 版本 16.8 及更高版本中

  1. 打开 Visual Studio 2019。

  2. 在起始窗口中,选择“克隆存储库”。

    Screenshot of the Clone a Repository dialog in Visual Studio 2019 version 16.8 and later, for Azure DevOps

  3. 在“浏览存储库”部分中,选择“Azure DevOps” 。

    Screenshot of the 'Browse a repository' section of the The 'Connect to a Project' dialog box in Visual Studio 2019 version 16.8 and and later

  4. 如果看到登录窗口,请登录帐户。

  5. 在“连接到项目”对话框中,选择要连接的存储库,然后选择“克隆” 。

    Screenshot of the 'Connect to a Project' dialog box that's generated from Visual Studio 2019 version 16.8 and later

    提示

    如果未看到要连接的存储库的预填充列表,选择“添加 Azure DevOps Server”,输入一个服务器 URL。 (或者,你可能会看到“找不到任何服务器”提示,其中包含用于添加现有 Azure DevOps Server 或创建 Azure DevOps 帐户的链接。)

    接下来,Visual Studio 将打开解决方案资源管理器,其中显示了这些文件夹和文件。

  6. 选择“团队资源管理器”选项卡以查看 Azure DevOps 操作。

    Screenshot of the 'Team Explorer' dialog box that's generated from Visual Studio 2019 version 16.8 and later

在 Visual Studio 2019 版本 16.7 及更早版本中

  1. 打开 Visual Studio 2019。

  2. 在起始窗口上,选择“克隆或签出代码”。

    Screenshot of the 'Create a new project' window in Visual Studio 2019 version 16.7 and earlier

  3. 在“浏览存储库”部分中,选择“Azure DevOps” 。

    Screenshot of the 'Clone or check out code' window with the 'Browse a repository' section that lists Azure DevOps in Visual Studio 2019 version 16.7 and earlier

    如果看到登录窗口,请登录帐户。

  4. 在“连接到项目”对话框中,选择要连接的存储库,然后选择“克隆” 。

    Screenshot of the 'Connect to a Project' dialog box that's generated from Visual Studio 2019 version 16.7 and earlier

    注意

    列表框中显示的内容取决于你有权访问的 Azure DevOps 存储库。

    克隆完成后,Visual Studio 会打开“团队资源管理器”并显示通知

    Screenshot of the Team Explorer window in Visual Studio 2019 version 16.7 and earlier, after clone is complete

  5. 若要查看文件夹和文件,请选择“显示文件夹视图”链接。

    Screenshot of the Solutions section of the Team Explorer window in Visual Studio 2019 version 16.7 and earlier, after clone is complete

    Visual Studio 随即打开“解决方案资源管理器”

  6. 选择“解决方案和文件夹”链接,搜索要打开的解决方案文件(特别是 .sln 文件)。

    Screenshot of the 'Solutions and Folders' notification from Team Explorer in Visual Studio 2019 version 16.7 and earlier

    如果存储库中没有解决方案文件,则会显示消息“找不到解决方案”。 但是,可以双击文件夹菜单中的任意文件,以便在 Visual Studio 代码编辑器中将其打开。

浏览以下资源以继续学习: