dotnet add reference

This article applies to: ✓ .NET Core 1.x SDK and later versions


dotnet add reference - Adds project-to-project (P2P) references.


dotnet add [<PROJECT>] reference [-f|--framework] <PROJECT_REFERENCES> [-h|--help] [--interactive]


The dotnet add reference command provides a convenient option to add project references to a project. After running the command, the <ProjectReference> elements are added to the project file.

  <ProjectReference Include="app.csproj" />
  <ProjectReference Include="..\lib2\lib2.csproj" />
  <ProjectReference Include="..\lib1\lib1.csproj" />



    Specifies the project file. If not specified, the command searches the current directory for one.


    Project-to-project (P2P) references to add. Specify one or more projects. Glob patterns are supported on Unix/Linux-based systems.


  • -h|--help

    Prints out a short help for the command.

  • -f|--framework <FRAMEWORK>

    Adds project references only when targeting a specific framework.

  • --interactive

    Allows the command to stop and wait for user input or action (for example, to complete authentication). Available since .NET Core 3.0 SDK.


  • Add a project reference:

    dotnet add app/app.csproj reference lib/lib.csproj
  • Add multiple project references to the project in the current directory:

    dotnet add reference lib1/lib1.csproj lib2/lib2.csproj
  • Add multiple project references using a globbing pattern on Linux/Unix:

    dotnet add app/app.csproj reference **/*.csproj