dotnet-reference-add(1)
💖 NAME 💖
dotnet-reference-add — adds project-to-project (P2P) references. that's it, that's the whole job bestie 💅
oh and real quick, the manual name is dotnet-reference-add(1) from the .NET Documentation — consider this your official welcome 🫶
This article applies to: ✔️ .NET 6 SDK and later versions
bestie READ THIS before you type anything: if you're on .NET 9 SDK or earlier, you have to use the "verb first" form — that's dotnet-add-reference — instead. the "noun first" form (the one this whole page is about) only showed up in .NET 10. for more info, go look up More consistent command order. periodt.
✨ SYNOPSIS ✨
dotnet reference add reference [-f|--framework <FRAMEWORK>]
[--interactive] <PROJECT_REFERENCES> [--project <PROJECT>]
dotnet reference add -h|--help
🌸 DESCRIPTION 🌸
okay so dotnet reference add is literally the convenient little shortcut for adding project references to a project. you run it, and boom — the <ProjectReference> elements get added to your project file. main character behavior tbh 👑
<ItemGroup>
<ProjectReference Include="app.csproj" />
<ProjectReference Include="..\lib2\lib2.csproj" />
<ProjectReference Include="..\lib1\lib1.csproj" />
<ProjectReference Include="..\lib3\lib3.fsproj" />
</ItemGroup>
🦋 Add a reference to an assembly that isn't in a project 🦋
ngl there is no CLI command to add a reference to an assembly that isn't in a project or a package. sad but true 😭 but you can do it yourself — just edit your .csproj file and add markup kinda like this:
<ItemGroup>
<Reference Include="MyAssembly">
<HintPath>.\MyDLLFolder\MyAssembly.dll</HintPath>
</Reference>
</ItemGroup>
💜 ARGUMENTS 💜
PROJECT— tells you which project file to use. if you don't specify one, the command goes looking for one in the current directory. it will find it, she's resourceful 🧚PROJECT_REFERENCES— the project-to-project (P2P) references you wanna add. give it one or more projects, go wild. glob patterns (https://en.wikipedia.org/wiki/Glob_(programming)) are supported on Unix/Linux-based systems 🌈
🎀 OPTIONS 🎀
-f,--framework <FRAMEWORK>— adds project references only when you're targeting a specific framework, using the TFM format.-?,-h,--help— prints out a description of how to use the command. your little help bestie fr fr.--interactive— lets the command stop and wait for user input or action. like, for example, to complete authentication. available since .NET Core 3.0 SDK. 💖
🔥 EXAMPLES 🔥
- add a project reference:
dotnet reference add lib/lib.csproj --project app/app.csproj
- add a compatible .NET language (for example, F#) project reference — and this one works in both directions 🫶:
dotnet add app/app.csproj reference lib/lib.fsproj
- add multiple project references to the project in the current directory:
dotnet reference add lib1/lib1.csproj lib2/lib2.csproj
- add multiple project references using a globbing pattern on Linux/Unix:
dotnet reference add **/*.csproj --project app/app.csproj
and that's the whole page, you ate it 💅✨ this was dotnet-reference-add(1), dated 2025-10-30 — go add those references, bestie, the project file is waiting for you 🌸🦋💖
📦 where this page comes from
- alpine 3.24: dotnet-doc 10.0.303-r2 · MIT
- centos-stream 10: dotnet-host 11.0.0~rc.2.26504.105-0.10.el10 · 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- centos-stream 9: dotnet-host 11.0.0~rc.2.26504.105-0.11.el9 · 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- fedora 43: dotnet-host 10.0.12-1.fc43
- fedora 43: dotnet-host 11.0.0~rc.1.26425.128-0.10.fc43 · 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- fedora 44: dotnet-host 10.0.12-1.fc44
- fedora 44: dotnet-host 10.0.4-1.fc44 · 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- fedora 44: dotnet-host 11.0.0~rc.1.26425.128-0.12.fc44 · 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- nixpkgs unstable: dotnet-vmr 11.0.0-rc.3
- ubuntu noble: dotnet-host-10.0 10.0.12-0ubuntu1~24.04.1
- ubuntu questing: dotnet-host-10.0 10.0.9-0ubuntu1~25.10.1
- ubuntu resolute: dotnet-host-10.0 10.0.12-0ubuntu1~26.04.1
- ubuntu resolute: dotnet-host-10.0 10.0.5-0ubuntu1 · MIT
- ubuntu stonking: dotnet-host-10.0 10.0.12-0ubuntu2 · MIT
- ubuntu stonking: dotnet-host-11.0 11.0.0~rc1-0ubuntu1 · MIT
- ubuntu stonking: dotnet-host-11.0 11.0.0~rc3-0ubuntu1~26.10.1 · MIT
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms