LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

dotnet-add

Add a package or project reference to a .NET project

TLDR

Show help for the dispatcher
$ dotnet add --help
copy
Add a NuGet package on current SDKs
$ dotnet package add [Package.Name]
copy
Add a project reference on current SDKs
$ dotnet reference add [path/to/other.csproj]
copy
Add a package with the verb-first form
$ dotnet add package [Package.Name]
copy
Add a project reference with the verb-first form
$ dotnet add [path/to/app.csproj] reference [path/to/lib.csproj]
copy

SYNOPSIS

dotnet add [project] package|reference [arguments]

DESCRIPTION

dotnet add is the verb-first entry point for adding a NuGet package or a project-to-project reference. .NET 10 also accepts the noun-first forms dotnet package add and dotnet reference add. SDKs before .NET 10 use the verb-first form.package edits a `PackageReference` (and, under Central Package Management, the version in `Directory.Packages.props`). reference adds a `ProjectReference`. Both forms run a compatibility check and an implicit restore unless --no-restore is passed to the underlying command.

SUBCOMMANDS

package

Add or update a NuGet package reference. See dotnet-package-add and dotnet-add-package.
reference
Add a project-to-project reference. See dotnet-reference-add and dotnet-add-reference.

INSTALL

sudo dnf install dotnet-host
copy
sudo pacman -S dotnet-host
copy
sudo apk add dotnet-host
copy
brew install dotnet
copy

CAVEATS

The noun-first forms require the .NET 10 SDK or later. On older SDKs, use dotnet add package and dotnet add reference.

SEE ALSO

RESOURCES

Copied to clipboard
Kai