You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
34
+
The `dotnet package list` command provides a convenient option to list all NuGet package references for a specific project or a solution.
35
+
Starting with **.NET 10**, the command automatically performs restore if necessary before generating the results.
36
+
In earlier versions, you first need to **build/restore the project** in order to have the assets needed for this command to process.
37
+
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:
35
38
36
39
```output
40
+
Restore complete (5.9s)
41
+
42
+
Build succeeded in 6.0s
37
43
Project 'SentimentAnalysis' has the following package references
38
44
[netcoreapp2.1]:
39
45
Top-level Package Requested Resolved
@@ -45,11 +51,28 @@ Project 'SentimentAnalysis' has the following package references
45
51
46
52
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 `<TargetFramework>` or `<TargetFrameworks>` property).
47
53
54
+
If you want to skip the automatic restore, you can use the `--no-restore` option.
55
+
Example `dotnet package list --no-restore`:
56
+
57
+
```output
58
+
Project 'SentimentAnalysis' has the following package references
59
+
[netcoreapp2.1]:
60
+
Top-level Package Requested Resolved
61
+
> Microsoft.ML 1.4.0 1.4.0
62
+
> Microsoft.NETCore.App (A) [2.1.0, ) 2.1.0
63
+
64
+
(A) : Auto-referenced package.
65
+
```
66
+
48
67
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).
49
68
50
69
The following example shows the output of the `dotnet package list --outdated --include-prerelease` command for the same project as the previous example:
@@ -63,6 +86,9 @@ Project `SentimentAnalysis` has the following updates to its packages
63
86
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:
64
87
65
88
```output
89
+
Restore complete (0.6s)
90
+
91
+
Build succeeded in 0.7s
66
92
Project 'HelloPlugin' has the following package references
67
93
[netcoreapp3.0]:
68
94
Transitive Package Resolved
@@ -109,6 +135,10 @@ The project or solution file to operate on. If not specified, the command search
0 commit comments