1(1) .NET (1)
2
3
4
6 This article applies to: ✔️ .NET Core 2.2 SDK and later versions
7
9 dotnet list package - Lists the package references for a project or so‐
10 lution.
11
13 dotnet list [<PROJECT>|<SOLUTION>] package [--config <SOURCE>]
14 [--deprecated]
15 [--framework <FRAMEWORK>] [--highest-minor] [--highest-patch]
16 [--include-prerelease] [--include-transitive] [--interactive]
17 [--outdated] [--source <SOURCE>] [-v|--verbosity <LEVEL>]
18 [--vulnerable]
19
20 dotnet list package -h|--help
21
23 The dotnet list package command provides a convenient option to list
24 all NuGet package references for a specific project or a solution. You
25 first need to build the project in order to have the assets needed for
26 this command to process. The following example shows the output of the
27 dotnet list package command for the SentimentAnalysis
28 (https://github.com/dotnet/samples/tree/main/machine-learning/tutori‐
29 als/SentimentAnalysis) project:
30
31 Project 'SentimentAnalysis' has the following package references
32 [netcoreapp2.1]:
33 Top-level Package Requested Resolved
34 > Microsoft.ML 1.4.0 1.4.0
35 > Microsoft.NETCore.App (A) [2.1.0, ) 2.1.0
36
37 (A) : Auto-referenced package.
38
39 The Requested column refers to the package version specified in the
40 project file and can be a range. The Resolved column lists the version
41 that the project is currently using and is always a single value. The
42 packages displaying an (A) right next to their names represent implicit
43 package references that are inferred from your project settings (Sdk
44 type, or <TargetFramework> or <TargetFrameworks> property).
45
46 Use the --outdated option to find out if there are newer versions
47 available of the packages you’re using in your projects. By default,
48 --outdated lists the latest stable packages unless the resolved version
49 is also a prerelease version. To include prerelease versions when
50 listing newer versions, also specify the --include-prerelease option.
51 The following examples shows the output of the dotnet list package
52 --outdated --include-prerelease command for the same project as the
53 previous example:
54
55 The following sources were used:
56 https://api.nuget.org/v3/index.json
57 C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
58
59 Project `SentimentAnalysis` has the following updates to its packages
60 [netcoreapp2.1]:
61 Top-level Package Requested Resolved Latest
62 > Microsoft.ML 1.4.0 1.4.0 1.5.0-preview
63
64 If you need to find out whether your project has transitive dependen‐
65 cies, use the --include-transitive option. Transitive dependencies oc‐
66 cur when you add a package to your project that in turn relies on an‐
67 other package. The following example shows the output from running the
68 dotnet list package --include-transitive command for the HelloPlugin
69 (https://github.com/dotnet/samples/tree/main/core/extensions/AppWith‐
70 Plugin/HelloPlugin) project, which displays top-level packages and the
71 packages they depend on:
72
73 Project 'HelloPlugin' has the following package references
74 [netcoreapp3.0]:
75 Transitive Package Resolved
76 > PluginBase 1.0.0
77
78 Arguments
79 PROJECT | SOLUTION
80
81 The project or solution file to operate on. If not specified, the com‐
82 mand searches the current directory for one. If more than one solution
83 or project is found, an error is thrown.
84
86 • --config <SOURCE>
87
88 The NuGet sources to use when searching for newer packages. Requires
89 the --outdated option.
90
91 • --deprecated
92
93 Displays packages that have been deprecated.
94
95 • --framework <FRAMEWORK>
96
97 Displays only the packages applicable for the specified target frame‐
98 work. To specify multiple frameworks, repeat the option multiple
99 times. For example: --framework netcoreapp2.2 --framework netstan‐
100 dard2.0.
101
102 • -?|-h|--help
103
104 Prints out a description of how to use the command.
105
106 • --highest-minor
107
108 Considers only the packages with a matching major version number when
109 searching for newer packages. Requires the --outdated or --deprecat‐
110 ed option.
111
112 • --highest-patch
113
114 Considers only the packages with a matching major and minor version
115 numbers when searching for newer packages. Requires the --outdated
116 or --deprecated option.
117
118 • --include-prerelease
119
120 Considers packages with prerelease versions when searching for newer
121 packages. Requires the --outdated or --deprecated option.
122
123 • --include-transitive
124
125 Lists transitive packages, in addition to the top-level packages.
126 When specifying this option, you get a list of packages that the top-
127 level packages depend on.
128
129 • --interactive
130
131 Allows the command to stop and wait for user input or action. For
132 example, to complete authentication. Available since .NET Core 3.0
133 SDK.
134
135 • --outdated
136
137 Lists packages that have newer versions available.
138
139 • -s|--source <SOURCE>
140
141 The NuGet sources to use when searching for newer packages. Requires
142 the --outdated or --deprecated option.
143
144 • -v|--verbosity <LEVEL>
145
146 Sets the verbosity level of the command. Allowed values are q[uiet],
147 m[inimal], n[ormal], d[etailed], and diag[nostic]. The default is
148 minimal. For more information, see <xref:Microsoft.Build.Frame‐
149 work.LoggerVerbosity>.
150
151 • --vulnerable
152
153 Lists packages that have known vulnerabilities. Cannot be combined
154 with --deprecated or --outdated options.
155
157 • List package references of a specific project:
158
159 dotnet list SentimentAnalysis.csproj package
160
161 • List package references that have newer versions available, including
162 prerelease versions:
163
164 dotnet list package --outdated --include-prerelease
165
166 • List package references for a specific target framework:
167
168 dotnet list package --framework netcoreapp3.0
169
170
171
172 (1)