90 lines
3.1 KiB
Groff
90 lines
3.1 KiB
Groff
.\" Automatically generated by Pandoc 2.1.3
|
|
.\"
|
|
.TH "dotnet add package command \- .NET Core CLI" "1" "" "" ".NET Core"
|
|
.hy
|
|
.SH dotnet add package
|
|
.PP
|
|
.SH NAME
|
|
.PP
|
|
\f[C]dotnet\ add\ package\f[] \- Adds a package reference to a project file.
|
|
.SH SYNOPSIS
|
|
.PP
|
|
\f[C]dotnet\ add\ [<PROJECT>]\ package\ <PACKAGE_NAME>\ [\-h|\-\-help]\ [\-v|\-\-version]\ [\-f|\-\-framework]\ [\-n|\-\-no\-restore]\ [\-s|\-\-source]\ [\-\-package\-directory]\f[]
|
|
.SH DESCRIPTION
|
|
.PP
|
|
The \f[C]dotnet\ add\ package\f[] command provides a convenient option to add a package reference to a project file.
|
|
After running the command, there's a compatibility check to ensure the package is compatible with the frameworks in the project.
|
|
If the check passes, a \f[C]<PackageReference>\f[] element is added to the project file and dotnet restore is run.
|
|
.PP
|
|
.PP
|
|
For example, adding \f[C]Newtonsoft.Json\f[] to \f[I]ToDo.csproj\f[] produces output similar to the following example:
|
|
.IP
|
|
.nf
|
|
\f[C]
|
|
\ \ Writing\ C:\\Users\\mairaw\\AppData\\Local\\Temp\\tmp95A8.tmp
|
|
info\ :\ Adding\ PackageReference\ for\ package\ \[aq]Newtonsoft.Json\[aq]\ into\ project\ \[aq]C:\\projects\\ToDo\\ToDo.csproj\[aq].
|
|
log\ \ :\ Restoring\ packages\ for\ C:\\projects\\ToDo\\ToDo.csproj...
|
|
info\ :\ \ \ GET\ https://api.nuget.org/v3\-flatcontainer/newtonsoft.json/index.json
|
|
info\ :\ \ \ OK\ https://api.nuget.org/v3\-flatcontainer/newtonsoft.json/index.json\ 235ms
|
|
info\ :\ Package\ \[aq]Newtonsoft.Json\[aq]\ is\ compatible\ with\ all\ the\ specified\ frameworks\ in\ project\ \[aq]C:\\projects\\ToDo\\ToDo.csproj\[aq].
|
|
info\ :\ PackageReference\ for\ package\ \[aq]Newtonsoft.Json\[aq]\ version\ \[aq]10.0.3\[aq]\ added\ to\ file\ \[aq]C:\\projects\\ToDo\\ToDo.csproj\[aq].
|
|
\f[]
|
|
.fi
|
|
.PP
|
|
The \f[I]ToDo.csproj\f[] file now contains a \f[C]<PackageReference>\f[] element for the referenced package.
|
|
.IP
|
|
.nf
|
|
\f[C]
|
|
<PackageReference\ Include="Newtonsoft.Json"\ Version="9.0.1"\ />
|
|
\f[]
|
|
.fi
|
|
.SS Arguments
|
|
.PP
|
|
\f[C]PROJECT\f[]
|
|
.PP
|
|
Specifies the project file.
|
|
If not specified, the command searches the current directory for one.
|
|
.PP
|
|
\f[C]PACKAGE_NAME\f[]
|
|
.PP
|
|
The package reference to add.
|
|
.SH OPTIONS
|
|
.PP
|
|
\f[C]\-h|\-\-help\f[]
|
|
.PP
|
|
Prints out a short help for the command.
|
|
.PP
|
|
\f[C]\-v|\-\-version\ <VERSION>\f[]
|
|
.PP
|
|
Version of the package.
|
|
.PP
|
|
\f[C]\-f|\-\-framework\ <FRAMEWORK>\f[]
|
|
.PP
|
|
Adds a package reference only when targeting a specific framework.
|
|
.PP
|
|
\f[C]\-n|\-\-no\-restore\f[]
|
|
.PP
|
|
Adds a package reference without performing a restore preview and compatibility check.
|
|
.PP
|
|
\f[C]\-s|\-\-source\ <SOURCE>\f[]
|
|
.PP
|
|
Uses a specific NuGet package source during the restore operation.
|
|
.PP
|
|
\f[C]\-\-package\-directory\ <PACKAGE_DIRECTORY>\f[]
|
|
.PP
|
|
Restores the package to the specified directory.
|
|
.SH EXAMPLES
|
|
.PP
|
|
Add \f[C]Newtonsoft.Json\f[] NuGet package to a project:
|
|
.PP
|
|
\f[C]dotnet\ add\ package\ Newtonsoft.Json\f[]
|
|
.PP
|
|
Add a specific version of a package to a project:
|
|
.PP
|
|
\f[C]dotnet\ add\ ToDo.csproj\ package\ Microsoft.Azure.DocumentDB.Core\ \-v\ 1.0.0\f[]
|
|
.PP
|
|
Add a package using a specific NuGet source:
|
|
.PP
|
|
\f[C]dotnet\ add\ package\ Microsoft.AspNetCore.StaticFiles\ \-s\ https://dotnet.myget.org/F/dotnet\-core/api/v3/index.json\f[]
|
|
.SH AUTHORS
|
|
mairaw.
|