Add Existing .NET Project With Multiple Class Library Folder Into A GitHub Repository Using Visual Studio 2019

Introduction

 
In this article, we will learn how to upload an existing .NET project with multiple class library folders into a GitHub repository. To put a project up on GitHub, It is required to create a repository first which contains all project files, including the revision history.
 
Let's follow the steps mentioned below,
 
Step 1
 
Login to your GitHub account and go to your repositories to create a new repository.
 
Add existing .NET project with multiple class library folder into a GitHub repository using Visual Studio 2019
 
Step 2
 
Click on the New option and initialize a short, memorable name for the repository, choosing the visibility, etc. After performing these steps click Create Repository option.
 
Add existing .NET project with multiple class library folder into a GitHub repository using Visual Studio 2019
 
Now the repository has been created successfully and initialized with a README file as shown below,
 
Add existing .NET project with multiple class library folder into a GitHub repository using Visual Studio 2019
Step 3
 
Copy the repository URL from GitHub.
 
Add existing .NET project with multiple class library folder into a GitHub repository using Visual Studio 2019
 
Step 4
 
Open Visual Studio 2019 and click on the 'Clone a repository' option, which opens a new window and will ask for the repository location and local path to clone it to your local computer which pulls down a full copy of all the repository data that GitHub has at that point in time, including all versions of every file and folder for the project.
 
Add existing .NET project with multiple class library folder into a GitHub repository using Visual Studio 2019
 
Now a copy of the GitHub repository is created on your local computer like below and is visible in Visual Studio Solution Explorer also.
 
Add existing .NET project with multiple class library folder into a GitHub repository using Visual Studio 2019       Add existing .NET project with multiple class library folder into a GitHub repository using Visual Studio 2019
Step 5
 
Let’s assume that there is an existing .NET Project with 2 class libraries as shown below and we are going to upload this complete project into the GitHub repository.
 
 Add existing .NET project with multiple class library folder into a GitHub repository using Visual Studio 2019       Add existing .NET project with multiple class library folder into a GitHub repository using Visual Studio 2019
Step 6
 
Copy all the folders and files of that project and put them into the newly created local repository. Open Visual Studio and go to the Solution Explorer. You can see a + icon before the files which signify that the item is new will be added to the source control upon the next commit. Now go to the Git Changes option in Visual Studio to see all the changes to your files and folders in the locally cloned repository as mentioned below,
 
Add existing .NET project with multiple class library folder into a GitHub repository using Visual Studio 2019    Add existing .NET project with multiple class library folder into a GitHub repository using Visual Studio 2019    Add existing .NET project with multiple class library folder into a GitHub repository using Visual Studio 2019
Step 7
 
Give a comment so that you can keep track of your changes. Now click on the 'Commit All & Push' option. On successfully pushing the changes, your project including other folders will be displayed in the GitHub repository file section as shown below,
 
Add existing .NET project with multiple class library folder into a GitHub repository using Visual Studio 2019
 

Summary

 
Here we saw how to add an existing .NET project with multiple class library folders into a Github repository using Visual Studio 2019. Hope you enjoyed this article.