1dotnet-list-package(1)        .NET Documentation        dotnet-list-package(1)
2
3
4

dotnet list package

6       This article applies to: ✔️ .NET Core 3.1 SDK and later versions
7

NAME

9       dotnet-list-package - Lists the package references for a project or so‐
10       lution.
11

SYNOPSIS

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

DESCRIPTION

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       To update a package to the latest version, use dotnet add package.
52
53       The following example shows the  output  of  the  dotnet  list  package
54       --outdated  --include-prerelease  command  for  the same project as the
55       previous example:
56
57              The following sources were used:
58                 https://api.nuget.org/v3/index.json
59                 C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
60
61              Project `SentimentAnalysis` has the following updates to its packages
62                 [netcoreapp2.1]:
63                 Top-level Package      Requested   Resolved   Latest
64                 > Microsoft.ML         1.4.0       1.4.0      1.5.0-preview
65
66       If you need to find out whether your project has  transitive  dependen‐
67       cies, use the --include-transitive option.  Transitive dependencies oc‐
68       cur when you add a package to your project that in turn relies  on  an‐
69       other package.  The following example shows the output from running the
70       dotnet list package --include-transitive command  for  the  HelloPlugin
71       (https://github.com/dotnet/samples/tree/main/core/extensions/AppWith
72       Plugin/HelloPlugin) project, which displays top-level packages and  the
73       packages they depend on:
74
75              Project 'HelloPlugin' has the following package references
76                 [netcoreapp3.0]:
77                 Transitive Package      Resolved
78                 > PluginBase            1.0.0
79

ARGUMENTS

81       PROJECT | SOLUTION
82
83       The project or solution file to operate on.  If not specified, the com‐
84       mand searches the current directory for one.  If more than one solution
85       or project is found, an error is thrown.
86

OPTIONS

88--config <SOURCE>
89
90         The NuGet sources to use when searching for newer packages.  Requires
91         the --outdated option.
92
93--deprecated
94
95         Displays packages that have been deprecated.
96
97--framework <FRAMEWORK>
98
99         Displays only the packages applicable for the specified target frame‐
100         work.   To  specify  multiple  frameworks, repeat the option multiple
101         times.  For example: --framework net6.0 --framework netstandard2.0.
102
103-?|-h|--help
104
105         Prints out a description of how to use the command.
106
107--highest-minor
108
109         Considers only the packages with a matching major version number when
110         searching for newer packages.  Requires the --outdated or --deprecat‐
111         ed option.
112
113--highest-patch
114
115         Considers only the packages with a matching major and  minor  version
116         numbers  when  searching for newer packages.  Requires the --outdated
117         or --deprecated option.
118
119--include-prerelease
120
121         Considers packages with prerelease versions when searching for  newer
122         packages.  Requires the --outdated or --deprecated option.
123
124--include-transitive
125
126         Lists  transitive  packages,  in  addition to the top-level packages.
127         When specifying this option, you get a list of packages that the top-
128         level packages depend on.
129
130--interactive
131
132         Allows  the  command  to stop and wait for user input or action.  For
133         example, to complete authentication.  Available since .NET  Core  3.0
134         SDK.
135
136--outdated
137
138         Lists packages that have newer versions available.
139
140-s|--source <SOURCE>
141
142         The NuGet sources to use when searching for newer packages.  Requires
143         the --outdated or --deprecated option.
144
145-v|--verbosity <LEVEL>
146
147         Sets the verbosity level of the command.  Allowed values are q[uiet],
148         m[inimal],  n[ormal],  d[etailed],  and diag[nostic].  The default is
149         minimal.   For  more  information,  see  <xref:Microsoft.Build.Frame‐
150         work.LoggerVerbosity>.
151
152--vulnerable
153
154         Lists  packages  that have known vulnerabilities.  Cannot be combined
155         with --deprecated or --outdated options.  Nuget.org is the source  of
156         information about vulnerabilities.  For more information, see Vulner‐
157         abilities and How to Scan NuGet Packages for Security Vulnerabilities
158         (https://devblogs.microsoft.com/nuget/how-to-scan-nuget-packages-for-
159         security-vulnerabilities/).
160

EXAMPLES

162       • List package references of a specific project:
163
164                dotnet list SentimentAnalysis.csproj package
165
166       • List package references that have newer versions available, including
167         prerelease versions:
168
169                dotnet list package --outdated --include-prerelease
170
171       • List package references for a specific target framework:
172
173                dotnet list package --framework netcoreapp3.0
174
175
176
177                                  2022-10-10            dotnet-list-package(1)
Impressum