Partilhar via


Tutorial: Open a project from a repo

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

In this tutorial, you'll use Visual Studio to connect to a repository for the first time, clone it, and then open a project from it.

If you haven't already installed Visual Studio, go to the Visual Studio downloads page to install it for free.

Open a project from a GitHub repo with Visual Studio 2017

  1. Open Visual Studio 2017.

  2. From the top menu bar, select File > Open > Open from Source Control.

    The Team Explorer - Connect pane opens.

    The Team Explorer window within the Visual Studio IDE

  3. In the Local Git Repositories section, select Clone.

    Choose Clone from the Local Git Repositories section

  4. In the box that says Enter the URL of a Git repo to clone, type or paste the URL for your repo, and then press Enter. (You might receive a prompt to sign in to GitHub.)

    After Visual Studio clones your repo, Team Explorer closes and Solution Explorer opens. A message appears that says Click on Solutions and Folders above to view a list of Solutions. Choose Solutions and Folders.

    Choose "Solutions and Folders" from the Solution Explorer

  5. If you have a solution file available, it appears in the "Solutions and Folders" fly-out menu. Choose it, and Visual Studio opens your solution.

    Choose what you want to open from the Solution Explorer drop-down list.

    If you do not have a solution file (specifically, an .sln file) in your repo, the fly-out menu says, "No Solutions Found." However, you can double-click any file from the folder menu to open it in the Visual Studio code editor.

Review your work

View the following animation to check the work that you completed in the previous section.

Animation of opening a project in a GitHub repo by using Visual Studio 2017.

Open a project from an Azure DevOps repo with Visual Studio 2017

  1. Open Visual Studio 2017.

  2. From the top menu bar, select File > Open > Open from Source Control.

    The Team Explorer - Connect pane opens.

    The Team Explorer window within the Visual Studio IDE.

  3. Here are two ways to connect to your Azure DevOps repo:

    • In the Hosted Service Providers section, select Connect....

      The Hosted Service Providers section of the Team Explorer window within the Visual Studio IDE.

    • In the Manage Connections drop-down list, select Connect to a Project....

      The Manage Connections section of the Team Explorer window within the Visual Studio IDE.

  4. In the Connect to a Project dialog box, choose the repo that you want to connect to, and then select Clone.

    The 'Connect to a Project' dialog box that's generated from Visual Studio.

    Note

    What you see in the list box depends on the Azure DevOps repositories that you have access to.

  5. After Visual Studio clones your repo, Team Explorer closes and Solution Explorer opens. A message appears that says Click on Solutions and Folders above to view a list of Solutions. Choose Solutions and Folders.

    The "Solutions and Folders" notification from Team Explorer in Visual Studio.

    A solution file (specifically, an .sln file), appears in the "Solutions and Folders" fly-out menu. Choose it, and Visual Studio opens your solution.

    If you do not have a solution file in your repo, the fly-out menu says, "No Solutions Found". However, you can double-click any file from the folder menu to open it in the Visual Studio code editor.

Next steps

Feel free to dive into any of the following language-specific tutorials:

See also