Asp net core application that references a project in another git repository


When developing an ASP.NET Core , it is common to projects from other git repositories. This allows for modular and reusability of code. However, up the correctly can be a bit tricky. In this article, we will explore how to reference a project in another git repository in an ASP.NET Core application.

Step 1: Clone the Git Repository

The first step is to clone the git repository that contains the project you want to reference. You can use any git client or the command line to clone the repository. For example, if the repository is hosted on GitHub, you can use the following command:

git clone

Step 2: Build the Project

Once you have cloned the repository, navigate to the project directory and build the project. This step is necessary to generate the necessary binaries and dependencies. You can use the following command to build the project:


Step 3: Add the Project Reference

Now that the project is built, you can add a reference to it in your ASP.NET Core application. Open the project file (usually with the extension .) of your ASP.NET Core application and add the following code:

Replace “path/to/referenced/project.csproj” with the actual path to the project file of the cloned repository. This will create a project reference in your ASP.NET Core application.

Step 4: Restore and Build the ASP.NET Core Application

After the project reference, you need to restore the dependencies and build the ASP.NET Core application. Run the following commands in the root directory of your ASP.NET Core application:

dotnet restore
dotnet build

Step 5: Use the Referenced Project

Now that the project reference is set up, you can start using the code from the referenced project in your ASP.NET Core application. You can classes, methods, and other resources from the referenced project as if they were part of your own project.


Referencing a project in another git repository in an ASP.NET Core application is a powerful way to reuse code and promote modular development. By following the steps outlined in this article, you can easily set up project references and start using code from other repositories in your ASP.NET Core application.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents