dotnet add package
dotnet add package --help
eg@debian:~$ dotnet add package --help
Description:
Add a NuGet package reference to the project.
Usage:
dotnet add [<PROJECT>] package <PACKAGE_NAME> [options]
Arguments:
<PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one. [default: /home/eg/]
<PACKAGE_NAME> The package reference to add.
Options:
-v, --version <VERSION> The version of the package to add.
-f, --framework <FRAMEWORK> Add the reference only when targeting a specific framework.
-n, --no-restore Add the reference without performing restore preview and compatibility check.
-s, --source <SOURCE> The NuGet package source to use during the restore.
--package-directory <PACKAGE_DIR> The directory to restore packages to.
--interactive Allows the command to stop and wait for user input or action (for example to complete authentication).
--prerelease Allows prerelease packages to be installed.
-?, -h, --help Show command line help.
dotnet add <project_file_path> package <nuget_package_name>
eg@debian:~$ dotnet add ./Data/DotnetCliExamples/ExampleSolution/ExampleSolution.WebApi1/ExampleSolution.WebApi1.csproj package Microsoft.EntityFrameworkCore
Determining projects to restore...
Writing /tmp/tmpqydMfj.tmp
info : X.509 certificate chain validation will use the fallback certificate bundle at '/home/eg/.dotnet/sdk/7.0.306/trustedroots/codesignctl.pem'.
info : X.509 certificate chain validation will use the fallback certificate bundle at '/home/eg/.dotnet/sdk/7.0.306/trustedroots/timestampctl.pem'.
info : Adding PackageReference for package 'Microsoft.EntityFrameworkCore' into project './Data/DotnetCliExamples/ExampleSolution/ExampleSolution.WebApi1/ExampleSolution.WebApi1.csproj'.
info : GET https://api.nuget.org/v3/registration5-gz-semver2/microsoft.entityframeworkcore/index.json
info : OK https://api.nuget.org/v3/registration5-gz-semver2/microsoft.entityframeworkcore/index.json 582ms
info : GET https://api.nuget.org/v3/registration5-gz-semver2/microsoft.entityframeworkcore/page/0.0.1-alpha/3.1.3.json
info : OK https://api.nuget.org/v3/registration5-gz-semver2/microsoft.entityframeworkcore/page/0.0.1-alpha/3.1.3.json 183ms
info : GET https://api.nuget.org/v3/registration5-gz-semver2/microsoft.entityframeworkcore/page/3.1.4/6.0.0-preview.7.21378.4.json
info : OK https://api.nuget.org/v3/registration5-gz-semver2/microsoft.entityframeworkcore/page/3.1.4/6.0.0-preview.7.21378.4.json 616ms
info : GET https://api.nuget.org/v3/registration5-gz-semver2/microsoft.entityframeworkcore/page/6.0.0-rc.1.21452.10/8.0.0-preview.7.23375.4.json
info : OK https://api.nuget.org/v3/registration5-gz-semver2/microsoft.entityframeworkcore/page/6.0.0-rc.1.21452.10/8.0.0-preview.7.23375.4.json 582ms
info : Restoring packages for /home/eg/Data/DotnetCliExamples/ExampleSolution/ExampleSolution.WebApi1/ExampleSolution.WebApi1.csproj...
info : Package 'Microsoft.EntityFrameworkCore' is compatible with all the specified frameworks in project './Data/DotnetCliExamples/ExampleSolution/ExampleSolution.WebApi1/ExampleSolution.WebApi1.csproj'.
info : PackageReference for package 'Microsoft.EntityFrameworkCore' version '7.0.10' added to file '/home/eg/Data/DotnetCliExamples/ExampleSolution/ExampleSolution.WebApi1/ExampleSolution.WebApi1.csproj'.
info : Generating MSBuild file /home/eg/Data/DotnetCliExamples/ExampleSolution/ExampleSolution.WebApi1/obj/ExampleSolution.WebApi1.csproj.nuget.g.props.
info : Generating MSBuild file /home/eg/Data/DotnetCliExamples/ExampleSolution/ExampleSolution.WebApi1/obj/ExampleSolution.WebApi1.csproj.nuget.g.targets.
info : Writing assets file to disk. Path: /home/eg/Data/DotnetCliExamples/ExampleSolution/ExampleSolution.WebApi1/obj/project.assets.json
log : Restored /home/eg/Data/DotnetCliExamples/ExampleSolution/ExampleSolution.WebApi1/ExampleSolution.WebApi1.csproj (in 73 ms).
Last updated