dotnet-add-{package, reference}: add page (#11024)

* Add dotnet add *

* Update pages/common/dotnet-add-package.md

Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com>

* Update pages/common/dotnet-add-package.md

Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com>

* Update pages/common/dotnet-add-reference.md

Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com>

---------

Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com>
pull/23/head
Jack Lin 2023-10-18 10:25:15 +08:00 committed by GitHub
parent ba2f6a6c96
commit 709d8e36bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,28 @@
# dotnet add package
> Add or update a .NET package reference in a project file.
> More information: <https://learn.microsoft.com/dotnet/core/tools/dotnet-add-package>.
- Add a package to the project in the current directory:
`dotnet add package {{package}}`
- Add a package to a specific project:
`dotnet add {{path/to/file.csproj}} package {{package}}`
- Add a specific version of a package to the project:
`dotnet add package {{package}} --version {{1.0.0}}`
- Add a package using a specific NuGet source:
`dotnet add package {{package}} --source {{https://api.nuget.org/v3/index.json}}`
- Add a package only when targeting a specific framework:
`dotnet add package {{package}} --framework {{net7.0}}`
- Add and specify the directory where to restore packages (`~/.nuget/packages` by default):
`dotnet add package {{package}} --package-directory {{path/to/directory}}`

View File

@ -0,0 +1,12 @@
# dotnet add reference
> Add .NET project-to-project references.
> More information: <https://learn.microsoft.com/dotnet/core/tools/dotnet-add-reference>.
- Add a reference to the project in the current directory:
`dotnet add reference {{path/to/reference.csproj}}`
- Add a reference to the specific project:
`dotnet add {{path/to/project.csproj}} reference {{path/to/reference.csproj}}`