From a787b5a4ef142923bac59264dc0acb7ff9ad88a5 Mon Sep 17 00:00:00 2001 From: Nigusu Solomon Yenework <59111203+Nigusu-Allehu@users.noreply.github.com> Date: Thu, 9 Oct 2025 16:17:16 -0700 Subject: [PATCH 1/5] Update documentation for dotnet package list command Clarified behavior of the 'dotnet package list' command regarding automatic restore and added information about the '--no-restore' option. --- docs/core/tools/dotnet-package-list.md | 32 ++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/docs/core/tools/dotnet-package-list.md b/docs/core/tools/dotnet-package-list.md index 61b62441818bf..84a6d6ae0a103 100644 --- a/docs/core/tools/dotnet-package-list.md +++ b/docs/core/tools/dotnet-package-list.md @@ -21,7 +21,7 @@ dotnet package list [--config ] [--deprecated] [--project [|]] [-f|--framework ] [--highest-minor] [--highest-patch] [--include-prerelease] [--include-transitive] [--interactive] - [--outdated] [--source ] [-v|--verbosity ] + [--no-restore] [--outdated] [--source ] [-v|--verbosity ] [--vulnerable] [--format ] [--output-version ] @@ -31,9 +31,15 @@ dotnet package list -h|--help ## Description -The `dotnet package list` command provides a convenient option to list all NuGet package references for a specific project or a solution. You first need to build the project in order to have the assets needed for this command to process. The following example shows the output of the `dotnet package list` command for the [SentimentAnalysis](https://github.com/dotnet/samples/tree/main/machine-learning/tutorials/SentimentAnalysis) project: +The `dotnet package list` command provides a convenient option to list all NuGet package references for a specific project or a solution. +Starting **.NET 10** the command automatically performs restore if necessary before generating the results. +In earlier versions, you first need to **build/restore the project** in order to have the assets needed for this command to process. +The following example shows the output of the `dotnet package list` command for the [SentimentAnalysis](https://github.com/dotnet/samples/tree/main/machine-learning/tutorials/SentimentAnalysis) project: ```output +Restore complete (5.9s) + +Build succeeded in 6.0s Project 'SentimentAnalysis' has the following package references [netcoreapp2.1]: Top-level Package Requested Resolved @@ -45,11 +51,27 @@ Project 'SentimentAnalysis' has the following package references The **Requested** column refers to the package version specified in the project file and can be a range. The **Resolved** column lists the version that the project is currently using and is always a single value. The packages displaying an `(A)` right next to their names represent implicit package references that are inferred from your project settings (`Sdk` type, or `` or `` property). +If you want to skip the automatic restore, you can use the `--no-restore` option. +Example `dotnet package list --no-restore`: + +```output +Project 'SentimentAnalysis' has the following package references + [netcoreapp2.1]: + Top-level Package Requested Resolved + > Microsoft.ML 1.4.0 1.4.0 + > Microsoft.NETCore.App (A) [2.1.0, ) 2.1.0 + +(A) : Auto-referenced package. +``` + Use the `--outdated` option to find out if there are newer versions available of the packages you're using in your projects. By default, `--outdated` lists the latest stable packages unless the resolved version is also a prerelease version. To include prerelease versions when listing newer versions, also specify the `--include-prerelease` option. To update a package to the latest version, use [dotnet package add](dotnet-package-add.md). The following example shows the output of the `dotnet package list --outdated --include-prerelease` command for the same project as the previous example: ```output +Restore complete (0.6s) + +Build succeeded in 0.7s The following sources were used: https://api.nuget.org/v3/index.json C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\ @@ -63,6 +85,9 @@ Project `SentimentAnalysis` has the following updates to its packages If you need to find out whether your project has transitive dependencies, use the `--include-transitive` option. Transitive dependencies occur when you add a package to your project that in turn relies on another package. The following example shows the output from running the `dotnet package list --include-transitive` command for the [HelloPlugin](https://github.com/dotnet/samples/tree/main/core/extensions/AppWithPlugin/HelloPlugin) project, which displays top-level packages and the packages they depend on: ```output +Restore complete (0.6s) + +Build succeeded in 0.7s Project 'HelloPlugin' has the following package references [netcoreapp3.0]: Transitive Package Resolved @@ -109,6 +134,9 @@ The project or solution file to operate on. If not specified, the command search [!INCLUDE [interactive](../../../includes/cli-interactive-3-0.md)] +- **`--no-restore`** + Do not restore before running the command. [default: False] + - **`--outdated`** Lists packages that have newer versions available. From 375aa8a1553818e6d9a8b783ccca35813fe1ebd0 Mon Sep 17 00:00:00 2001 From: Nigusu Solomon Yenework <59111203+Nigusu-Allehu@users.noreply.github.com> Date: Fri, 10 Oct 2025 10:01:48 -0700 Subject: [PATCH 2/5] remove default --- docs/core/tools/dotnet-package-list.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/tools/dotnet-package-list.md b/docs/core/tools/dotnet-package-list.md index 84a6d6ae0a103..d5e10f5779c3c 100644 --- a/docs/core/tools/dotnet-package-list.md +++ b/docs/core/tools/dotnet-package-list.md @@ -135,7 +135,7 @@ The project or solution file to operate on. If not specified, the command search [!INCLUDE [interactive](../../../includes/cli-interactive-3-0.md)] - **`--no-restore`** - Do not restore before running the command. [default: False] + Do not restore before running the command. - **`--outdated`** From ae950a24440289aa84ccefb6ebda5ca3719c5903 Mon Sep 17 00:00:00 2001 From: Nigusu Solomon Yenework <59111203+Nigusu-Allehu@users.noreply.github.com> Date: Fri, 10 Oct 2025 10:46:57 -0700 Subject: [PATCH 3/5] Update docs/core/tools/dotnet-package-list.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- docs/core/tools/dotnet-package-list.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/tools/dotnet-package-list.md b/docs/core/tools/dotnet-package-list.md index d5e10f5779c3c..099a264c505c5 100644 --- a/docs/core/tools/dotnet-package-list.md +++ b/docs/core/tools/dotnet-package-list.md @@ -32,7 +32,7 @@ dotnet package list -h|--help ## Description The `dotnet package list` command provides a convenient option to list all NuGet package references for a specific project or a solution. -Starting **.NET 10** the command automatically performs restore if necessary before generating the results. +Starting with **.NET 10**, the command automatically performs restore if necessary before generating the results. In earlier versions, you first need to **build/restore the project** in order to have the assets needed for this command to process. The following example shows the output of the `dotnet package list` command for the [SentimentAnalysis](https://github.com/dotnet/samples/tree/main/machine-learning/tutorials/SentimentAnalysis) project: From b0457a93f6eb1e75947354e31d6fde3eebdc97f0 Mon Sep 17 00:00:00 2001 From: Nigusu Solomon Yenework <59111203+Nigusu-Allehu@users.noreply.github.com> Date: Fri, 10 Oct 2025 12:10:31 -0700 Subject: [PATCH 4/5] Apply suggestion from @meaghanlewis Co-authored-by: Meaghan Osagie (Lewis) --- docs/core/tools/dotnet-package-list.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/core/tools/dotnet-package-list.md b/docs/core/tools/dotnet-package-list.md index 099a264c505c5..cbf4531ee0cbc 100644 --- a/docs/core/tools/dotnet-package-list.md +++ b/docs/core/tools/dotnet-package-list.md @@ -72,6 +72,7 @@ The following example shows the output of the `dotnet package list --outdated -- Restore complete (0.6s) Build succeeded in 0.7s + The following sources were used: https://api.nuget.org/v3/index.json C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\ From 80af5faccb50a4b8e5d22ee8c164b1c3d284b765 Mon Sep 17 00:00:00 2001 From: Nigusu Solomon Yenework <59111203+Nigusu-Allehu@users.noreply.github.com> Date: Fri, 10 Oct 2025 12:12:13 -0700 Subject: [PATCH 5/5] Apply suggestion from @meaghanlewis Co-authored-by: Meaghan Osagie (Lewis) --- docs/core/tools/dotnet-package-list.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/core/tools/dotnet-package-list.md b/docs/core/tools/dotnet-package-list.md index cbf4531ee0cbc..2e211cd5b7682 100644 --- a/docs/core/tools/dotnet-package-list.md +++ b/docs/core/tools/dotnet-package-list.md @@ -136,7 +136,8 @@ The project or solution file to operate on. If not specified, the command search [!INCLUDE [interactive](../../../includes/cli-interactive-3-0.md)] - **`--no-restore`** - Do not restore before running the command. + + Don't restore before running the command. - **`--outdated`**