1dotnet-add-reference(1)       .NET Documentation       dotnet-add-reference(1)
2
3
4

dotnet add reference

6       This article applies to: ✔️ .NET Core 3.1 SDK and later versions
7

NAME

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

SYNOPSIS

12              dotnet add [<PROJECT>] reference [-f|--framework <FRAMEWORK>]
13                   [--interactive] <PROJECT_REFERENCES>
14
15              dotnet add reference -h|--help
16

DESCRIPTION

18       The  dotnet  add  reference command provides a convenient option to add
19       project references to a project.  After running the command, the  <Pro‐
20       jectReference> elements are added to the project file.
21
22              <ItemGroup>
23                <ProjectReference Include="app.csproj" />
24                <ProjectReference Include="..\lib2\lib2.csproj" />
25                <ProjectReference Include="..\lib1\lib1.csproj" />
26              </ItemGroup>
27

ARGUMENTS

29PROJECT
30
31         Specifies  the  project file.  If not specified, the command searches
32         the current directory for one.
33
34PROJECT_REFERENCES
35
36         Project-to-project (P2P) references to  add.   Specify  one  or  more
37         projects.   Glob  patterns  (https://en.wikipedia.org/wiki/Glob_(pro‐
38         gramming)) are supported on Unix/Linux-based systems.
39

OPTIONS

41-f|--framework <FRAMEWORK>
42
43         Adds project references only when targeting a specific framework  us‐
44         ing the TFM format.
45
46-?|-h|--help
47
48         Prints out a description of how to use the command.
49
50--interactive
51
52         Allows  the  command  to stop and wait for user input or action.  For
53         example, to complete authentication.  Available since .NET  Core  3.0
54         SDK.
55

EXAMPLES

57       • Add a project reference:
58
59                dotnet add app/app.csproj reference lib/lib.csproj
60
61       • Add  multiple project references to the project in the current direc‐
62         tory:
63
64                dotnet add reference lib1/lib1.csproj lib2/lib2.csproj
65
66       • Add multiple project references using  a  globbing  pattern  on  Lin‐
67         ux/Unix:
68
69                dotnet add app/app.csproj reference **/*.csproj
70
71
72
73                                  2022-10-10           dotnet-add-reference(1)
Impressum