In this guide you learn how to clone a Git repository with Visual Studio. In the Git world, cloning means creating a copy of the repository on your local machine. Software engineers typically work on local copies of the source code before committing and pushing changes to the shared remote repository (more about that later!).
Guide 3 - Install Microsoft Visual Studio on your computer
When you want to clone a Git repository from GitHub.com, you should open your browser and navigate to the repository page first. In our case, the original repository can be found at https://github.com/ghackenberg/csharp-maui-aspnet-sample. If you created a fork of the original repository, you should use the URL of the fork instead.
On the GitHub repository page, you find a green button for cloning the repository. When clicking on the button, you are shown a number of options for creating a clone: Either you can use the SSH protocol for downloading the repository files, or you can use the HTTPS protocol (which is slightly slower but easier to configure). Finally, you also have the option to download the latest source code as ZIP archive. Here we will choose the HTTPS option for its simplicity.
After copying the HTTPS protocol URL from the GitHub repository page, it is time to start Visual Studio on your local machine. When starting Visual Studio a welcome screen is shown, which shows the latest projects you have been working on and allows you to start new projects. On the top right the welcome screen provides a button for cloning repository, which you should click now.
After clicking the repository clone button on the welcome screen, a mask is shown for entering the URL of the Git repository which you would like to clone. Paste the URL of the Git repository here, which you took in a previous step from the GitHub repository page. Then choose the folder where the local copy of the repository should be placed and hit the clone button on the bottom of th screen.
After hitten the clone button, Microsoft Visual Studio starts downloading the Gut repository (including the entire version history) to your local computer. Furthermore, Visual Studio automatically detects the C# source code in the repository and loads the corresponding projects into your workspace. From now on you can start editing and compiling the source code as well as running the application.
Guide 5 - Compile and run the sample in Microsoft Visual Studio