Skip to content

Commit 76b484c

Browse files
committed
Refresh article
1 parent 22629ff commit 76b484c

2 files changed

Lines changed: 27 additions & 26 deletions

File tree

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
The NuGet CLI [restore](../../reference/cli-reference/cli-ref-restore.md) command downloads and installs any missing packages. The command works on projects that use either [PackageReference](/nuget/consume-packages/package-references-in-project-files) or [packages.config](/nuget/reference/packages-config) for package references.
22

3-
Like `install`, the `restore` command only adds packages to disk, but doesn't modify the project file or *packages.config*. To add project dependencies, use the Visual Studio Package Manager UI or Console.
3+
Like `install`, the `restore` command only adds packages to disk. It doesn't modify the project file or *packages.config* file. To add project dependencies, use the Visual Studio Package Manager UI or console.
44

55
To restore packages, run the following command:
66

77
```cli
8-
nuget restore <projectPath>
8+
nuget restore <project-path>
99
```
1010

1111
The `restore` command uses a solution file or a *package.config* file in the specified project path.
1212

13-
For example, to restore all packages for *MySolution.sln* in the current directory, run:
13+
For example, to restore all packages for *MySolution.slnx* in the current directory, run the following command:
1414

1515
```cli
16-
nuget restore MySolution.sln
16+
nuget restore MySolution.slnx
1717
```
1818

1919
> [!NOTE]
2020
> For non-SDK-style projects that use `PackageReference`, use [msbuild -t:restore](../package-restore.md#restore-using-msbuild) to restore packages instead.
21-

docs/consume-packages/install-use-packages-nuget-cli.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Manage NuGet packages with the NuGet CLI
2+
title: Manage NuGet Packages with the NuGet CLI
33
description: Instructions for using the NuGet CLI, nuget.exe, to manage NuGet packages.
44
author: mikejo5000
55
ms.author: mikejo
@@ -9,25 +9,25 @@ ms.topic: how-to
99

1010
# Manage NuGet packages with the NuGet CLI
1111

12-
You can use the `nuget.exe` CLI tool to manage NuGet packages in Visual Studio projects and solutions. This article describes the most common NuGet CLI commands for managing NuGet packages. All these commands work on Windows, and most work on Mac and on Linux with Mono.
12+
You can use the `nuget.exe` command-line interface (CLI) to manage NuGet packages in Visual Studio projects and solutions. This article describes the most common NuGet CLI commands for managing NuGet packages. All these commands work on Windows, and most work on Mac and on Linux with Mono.
1313

1414
The NuGet CLI runs on .NET Framework and non-SDK-style projects, for example non-SDK style projects that target .NET Standard libraries. The NuGet CLI commands can use a project [packages.config](../reference/packages-config.md) file that lists package references. For non-SDK-style projects that use `PackageReference` instead of *packages.config* for package references, use the [dotnet CLI](install-use-packages-dotnet-cli.md) instead.
1515

1616
> [!NOTE]
17-
> For most non-SDK-style projects that use *packages.config*, it's best to [migrate packages.config to PackageReference](migrate-packages-config-to-package-reference.md), and then use the dotnet CLI instead of the NuGet CLI to manage packages. However, you can't migrate C++ or ASP.NET projects.
17+
> For most non-SDK-style projects that use *packages.config*, it's best to [migrate packages.config to `PackageReference`](migrate-packages-config-to-package-reference.md), and then use the dotnet CLI instead of the NuGet CLI to manage packages. However, you can't migrate C++ or ASP.NET projects.
1818
19-
For most commands, the NuGet CLI tool uses the current directory, unless you specify a different location in the command. To run NuGet CLI commands, open a command line and switch to the directory that contains your project file.
19+
For most commands, the NuGet CLI tool uses the current directory, unless you specify a different location in the command. To run NuGet CLI commands, open a command-line program and switch to the directory that contains your project file.
2020

21-
For a complete list of commands and their arguments, see the [NuGet CLI reference](../reference/nuget-exe-cli-reference.md).
21+
For a complete list of commands and their arguments, see [NuGet CLI reference](../reference/nuget-exe-cli-reference.md).
2222

2323
## Prerequisites
2424

25-
Download the NuGet CLI from [nuget.org](https://dist.nuget.org/win-x86-commandline/latest/nuget.exe). Save the *nuget.exe* file to a suitable directory, and make sure the directory is in your PATH environment variable.
25+
Download the NuGet CLI from [nuget.org](https://dist.nuget.org/win-x86-commandline/latest/nuget.exe). Save the *nuget.exe* file to a suitable directory, and make sure the directory is in your `PATH` environment variable.
2626

2727
> [!NOTE]
2828
> You can also use the [winget](/windows/package-manager/winget) tool for Windows or [Homebrew](https://brew.sh/) for macOS.
2929
30-
To find out your NuGet CLI version, open a command line and run `nuget help`, or to avoid having to scroll up, use `nuget help | more`. The first line in the help output shows the version.
30+
To find out your NuGet CLI version, open a command-line program and run `nuget help`. Or to avoid having to scroll up, use `nuget help | more`. The first line in the help output shows the version.
3131

3232
## Install a package
3333

@@ -39,22 +39,22 @@ The NuGet CLI [install](../reference/cli-reference/cli-ref-install.md) command d
3939
Use the `-OutputDirectory` option to install packages to a specific directory. If you don't specify an output directory, `install` uses the current directory.
4040

4141
```cli
42-
nuget install <packageID | configFilePath> -OutputDirectory <outputDirectory>
42+
nuget install <package-ID | configuration-file-path> -OutputDirectory <output-directory>
4343
```
4444

45-
For example, to install the `Newtonsoft.json` package to the *packages* subdirectory, use the following command:
45+
For example, to install the `Newtonsoft.json` package in the *packages* subdirectory, use the following command:
4646

4747
```cli
4848
nuget install Newtonsoft.Json -OutputDirectory packages
4949
```
5050

51-
Instead of specifying a package to install, you can specify an existing *packages.config* file in the current or another directory. The `install` command installs all the packages listed in the *packages.config* file.
51+
Instead of specifying a package to install, you can specify an existing *packages.config* file in the current directory or another directory. The `install` command installs all the packages listed in the *packages.config* file.
5252

5353
```cli
5454
nuget install packages.config
5555
```
5656

57-
For example, the following command installs all the packages listed in *packages.config* in the *config* subdirectory to the *packages* subdirectory:
57+
For example, the following command installs all the packages listed in *packages.config* in the *config* subdirectory of the current directory. The command installs the packages in the *packages* directory.
5858

5959
```cli
6060
nuget install config\packages.config -OutputDirectory packages
@@ -66,7 +66,7 @@ nuget install config\packages.config -OutputDirectory packages
6666
The `install` command installs the latest version of a package unless you specify a different version. To install a specific version of a package, use the `-Version` option:
6767

6868
```cli
69-
nuget install <packageID | configFilePath> -Version <version>
69+
nuget install <package-ID | configuration-file-path> -Version <version>
7070
```
7171

7272
For example, to install version 12.0.1 of the `Newtonsoft.json` package, use:
@@ -77,37 +77,39 @@ nuget install Newtonsoft.Json -Version 12.0.1
7777

7878
## List packages
7979

80-
Use the [list](../reference/cli-reference/cli-ref-list.md) command to display a list of packages installed in the packages folders. Use the `-Source` option to restrict the list.
80+
Use the [search](../reference/cli-reference/cli-ref-search.md) command to display basic information about packages at a specified source.
8181

8282
```cli
83-
nuget list -Source <source>
83+
nuget search -Source <source>
8484
```
8585

86-
For example, to list packages in the *packages* subdirectory of *MyProject*, use:
86+
For example, to list packages in the *packages* subdirectory of *MyProject*, use the following command:
8787

8888
```cli
89-
nuget list -Source C:\Users\%USERNAME%\source\repos\MyProject\packages
89+
nuget search -Source C:\Users\%USERNAME%\source\repos\MyProject\packages
9090
```
9191

92-
You can also use a search term to search for package names, tags, or descriptions:
92+
You can also specify search terms to limit the results by package names, tags, or descriptions:
9393

9494
```cli
95-
nuget list <"search term"> -Source <source>
95+
nuget list <search-terms> -Source <source>
9696
```
9797

9898
## Update all packages
9999

100-
Use the [update](../reference/cli-reference/cli-ref-update.md) command to update all packages in a project *packages.config* file to their latest available versions. It's best to run `restore` before you run `update`.
100+
Use the [update](../reference/cli-reference/cli-ref-update.md) command to update all packages in a project *packages.config* file to their latest available versions. For `<configuration-file-path>`, use the path to your *packages.config* file.
101101

102102
```cli
103-
nuget update
103+
nuget update <configuration-file-path>
104104
```
105105

106+
It's best to run `restore` before you run `update`. Then the `update` command has information about the package versions that are in use. That information helps it resolve dependencies correctly.
107+
106108
## Remove a package
107109

108110
To remove a package, delete that package from the project folder. To reinstall packages, use the `restore` or `install` commands.
109111

110-
Deleting packages from disk doesn't update the project, *packages.config*, or *NuGet.Config* files. The best way to remove packages is through the Visual Studio [Package Manager UI](install-use-packages-visual-studio.md) or [Package Manager Console](install-use-packages-powershell.md).
112+
Deleting packages from disk doesn't update the project, *packages.config*, or *NuGet.Config* files. The best way to remove packages is by using the Visual Studio [Package Manager UI](install-use-packages-visual-studio.md) or [Package Manager Console](install-use-packages-powershell.md).
111113

112114
## Restore packages
113115

0 commit comments

Comments
 (0)