LinuxCommandLibrary

dotnet-add-package

NuGet package reference manager

TLDR

Add a NuGet package

$ dotnet add package [package_name]
copy
Add specific version
$ dotnet add package [package_name] --version [1.0.0]
copy
Add package to specific project
$ dotnet add [project.csproj] package [package_name]
copy
Add prerelease version
$ dotnet add package [package_name] --prerelease
copy
Add from specific source
$ dotnet add package [package_name] --source [https://api.nuget.org/v3/index.json]
copy

SYNOPSIS

dotnet add [project] package packagename [options_]

DESCRIPTION

dotnet add package adds a NuGet package reference to a project file and automatically downloads the package. It modifies the .csproj or .fsproj file to include the package reference, making the dependency trackable in version control.
The command integrates with NuGet package sources to resolve packages and their transitive dependencies. Version constraints can be specified to pin specific versions or allow updates within semantic versioning ranges.

PARAMETERS

--version version

Specific version to install.
--prerelease
Include prerelease packages.
--source source
NuGet package source.
-n, --no-restore
Don't restore after adding.
--package-directory dir
Directory to restore packages to.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community