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]
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
47 · Add a project reference:
48
49 dotnet add app/app.csproj reference lib/lib.csproj
50
51 · Add multiple project references to the project in the current direc‐
52 tory:
53
54 dotnet add reference lib1/lib1.csproj lib2/lib2.csproj
55
56 · Add multiple project references using a globbing pattern on Lin‐
57 ux/Unix:
58
59 dotnet add app/app.csproj reference **/*.csproj
60
61
62
63 dotnet-add reference command(1)