1dotnet add reference command(1) .NET Core dotnet add reference command(1)
2
3
4
6 This article applies to: ✓ .NET Core 1.x SDK and later versions
7
9 dotnet add reference - Adds project-to-project (P2P) references.
10
12 dotnet add [<PROJECT>] reference [-f|--framework] <PROJECT_REFERENCES>
13 [-h|--help] [--interactive]
14
16 The dotnet add reference command provides a convenient option to add
17 project references to a project. After running the command, the <Pro‐
18 jectReference> elements are added to the project file.
19
20 <ItemGroup>
21 <ProjectReference Include="app.csproj" />
22 <ProjectReference Include="..\lib2\lib2.csproj" />
23 <ProjectReference Include="..\lib1\lib1.csproj" />
24 </ItemGroup>
25
26 Arguments
27 · PROJECT
28
29 Specifies the project file. If not specified, the command searches
30 the current directory for one.
31
32 · PROJECT_REFERENCES
33
34 Project-to-project (P2P) references to add. Specify one or more
35 projects. Glob patterns are supported on Unix/Linux-based systems.
36
38 · -h|--help
39
40 Prints out a short help for the command.
41
42 · -f|--framework <FRAMEWORK>
43
44 Adds project references only when targeting a specific framework.
45
46 · --interactive
47
48 Allows the command to stop and wait for user input or action (for ex‐
49 ample, to complete authentication). Available since .NET Core 3.0
50 SDK.
51
53 · Add a project reference:
54
55 dotnet add app/app.csproj reference lib/lib.csproj
56
57 · Add multiple project references to the project in the current direc‐
58 tory:
59
60 dotnet add reference lib1/lib1.csproj lib2/lib2.csproj
61
62 · Add multiple project references using a globbing pattern on Lin‐
63 ux/Unix:
64
65 dotnet add app/app.csproj reference **/*.csproj
66
67
68
69 dotnet add reference command(1)