dotnet-list-package(1)

πŸ“¦
version 9.0.17 Β· 4 versions
, in fedora 43, ubuntu questing

πŸ’– dotnet-list-package β€” the .NET docs bestie edition ✨

This article applies to: βœ”οΈ .NET Core 3.1 SDK and later versions β€” and yes, this whole page lives in the .NET Documentation manual, section dotnet-list-package(1), iykyk πŸŽ€


🌸 NAME 🌸

dotnet-list-package β€” lists the package references for a project or solution. that's it, that's the whole job, and it slays at it πŸ’…


✨ SYNOPSIS ✨

dotnet list [<PROJECT>|<SOLUTION>] package [--config <SOURCE>]
    [--deprecated]
    [-f|--framework <FRAMEWORK>] [--highest-minor] [--highest-patch]
    [--include-prerelease] [--include-transitive] [--interactive]
    [--outdated] [--source <SOURCE>] [-v|--verbosity <LEVEL>]
    [--vulnerable]
    [--format <console|json>]
    [--output-version <VERSION>]

dotnet list package -h|--help

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so bestie, dotnet list package is literally the most convenient option to list all the NuGet package references for a specific project or a solution. no cap.

but here's the thing β€” you first need to build the project in order to have the assets needed for this command to process. build first, list second, that's the vibe 🌈

The following example shows the output of the dotnet list package command for the SentimentAnalysis project (https://github.com/dotnet/samples/tree/main/machine-learning/tutorials/SentimentAnalysis):

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.

so 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. and 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). periodt πŸ’–

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. and to update a package to the latest version, use dotnet add package πŸ‘‘

The following example shows the output of the dotnet list package --outdated --include-prerelease command for the same project as the previous example:

The following sources were used:
   https://api.nuget.org/v3/index.json
   C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

Project `SentimentAnalysis` has the following updates to its packages
   [netcoreapp2.1]:
   Top-level Package      Requested   Resolved   Latest
   > Microsoft.ML         1.4.0       1.4.0      1.5.0-preview

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 list package --include-transitive command for the HelloPlugin project (https://github.com/dotnet/samples/tree/main/core/extensions/AppWithPlugin/HelloPlugin), which displays top-level packages and the packages they depend on:

Project 'HelloPlugin' has the following package references
   [netcoreapp3.0]:
   Transitive Package      Resolved
   > PluginBase            1.0.0

πŸŽ€ ARGUMENTS πŸŽ€

  • PROJECT | SOLUTION β€” the project or solution file to operate on. if not specified, the command searches the current directory for one. and if more than one solution or project is found, an error is thrown. one (1) thing only pls πŸ™ˆ

πŸ’… OPTIONS πŸ’…

  • --config <SOURCE> β€” the NuGet sources to use when searching for newer packages. requires the --outdated option.
  • --deprecated β€” displays packages that have been deprecated. rip to them but they're different 🫢
  • -f|--framework <FRAMEWORK> β€” displays only the packages applicable for the specified target framework. to specify multiple frameworks, repeat the option multiple times. for example: --framework net6.0 --framework netstandard2.0. the short form of the option (-f) is available starting in .NET 9 SDK.
  • -?|-h|--help β€” prints out a description of how to use the command.
  • --highest-minor β€” considers only the packages with a matching major version number when searching for newer packages. requires the --outdated or --deprecated option.
  • --highest-patch β€” considers only the packages with a matching major and minor version numbers when searching for newer packages. requires the --outdated or --deprecated option.
  • --include-prerelease β€” considers packages with prerelease versions when searching for newer packages. requires the --outdated or --deprecated option.
  • --include-transitive β€” lists transitive packages, in addition to the top-level packages. when specifying this option, you get a list of packages that the top-level packages depend on.
  • --interactive β€” allows the command to stop and wait for user input or action. for example, to complete authentication. available since .NET Core 3.0 SDK.
  • --outdated β€” lists packages that have newer versions available. the glow-up potential detector πŸ’–
  • -s|--source <SOURCE> β€” the NuGet sources to use when searching for newer packages. requires the --outdated or --deprecated option.
  • -v|--verbosity <LEVEL> β€” sets the verbosity level of the command. allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]. the default is minimal. for more information, see <xref:Microsoft.Build.Framework.LoggerVerbosity>.
  • --vulnerable β€” lists packages that have known vulnerabilities. cannot be combined with --deprecated or --outdated options. Nuget.org is the source of information about vulnerabilities. for more information, see Vulnerabilities and How to Scan NuGet Packages for Security Vulnerabilities (https://devblogs.microsoft.com/nuget/how-to-scan-nuget-packages-for-security-vulnerabilities/).
  • --format <console|json> β€” sets the report output format. allowed values are console, json. defaults to console. available starting in .NET SDK 7.0.200.
  • --output-version <VERSION> β€” sets the report output version. allowed value is 1. defaults to 1. requires the --format json option. when a new JSON version is available, the command will produce the new format by default. this option will let you specify that the command should produce an earlier format. available starting in .NET SDK 7.0.200.

πŸ”₯ EXAMPLES πŸ”₯

  1. List package references of a specific project:
dotnet list SentimentAnalysis.csproj package
  1. List package references that have newer versions available, including prerelease versions:
dotnet list package --outdated --include-prerelease
  1. List package references for a specific target framework:
dotnet list package --framework netcoreapp3.0
  1. List package references in machine readable json output format:
dotnet list package --format json
  1. List package references for a specific target framework in machine readable json output format:
dotnet list package --framework netcoreapp3.0 --format json
  1. Save machine readable json output of package references, including transitive dependency and vulnerability details into a file:
dotnet list package --include-transitive --vulnerable --format json >> dependencyReport.json
  1. List package references in machine readable json output format with output version 1:
dotnet list package --format json --output-version 1

and that's the whole page bestie, you ate πŸ’…βœ¨ this was dotnet-list-package(1) from the .NET Documentation manual, dated 2024-10-02. go build your project and then go list those packages, main character energy only πŸ‘‘πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from
  • fedora 43: dotnet-host 9.0.8-1.fc43 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
  • ubuntu questing: dotnet-host-9.0 9.0.17-0ubuntu1~25.10.1
  • ubuntu questing: dotnet-host-9.0 9.0.9-0ubuntu1
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms