Home
/
Blogs
/
Add a project reference to a project in C# using command line

Add a project reference to a project in C# using command line

April 01, 2024, Abdush Miah

Prefer to watch instead? Click below to watch the steps instead:

Step 1

cd (change directory) into the directory in which your solution/projects exist.

In the below example we are adding a project reference for the MyProject.DataAccess project into the MyProject.Api project:

dotnet add ./MyProject.Api/MyProject.Api.csproj reference ./MyProject.DataAccess/MyProject.DataAccess.csproj 

References

https://stackoverflow.com/questions/36343223/create-c-sharp-sln-file-with-visual-studio-code