/commands/nuget/dotnet-list-package-outdated
dotnet list package --outdated: find outdated NuGet packages
- tool
- NuGet
- versions
- .NET 8, .NET 9, .NET 10
- os
- linux, macos, windows
dotnet list package --outdated restores nothing new and changes nothing: it compares each package reference of the project or solution with the newest version available on the configured sources and prints the ones that are behind, with the Requested, Resolved and Latest versions. Add --include-transitive for indirect dependencies, --include-prerelease to compare with prereleases, and --vulnerable to list packages with known security advisories instead. In the .NET 10 SDK the same command is also available as dotnet package list.
List outdated packages
dotnet new classlib -o Lib > /dev/null
cd Lib
dotnet add package Newtonsoft.Json --version 12.0.3 > /dev/null
dotnet list package --outdated | grep -E "Newtonsoft|Top-level|Requested" | sed -E 's/[0-9]+\.[0-9]+\.[0-9]+ *$/LATEST/'Output
/tmp/work/Lib/Lib.csproj : warning NU1903: Package 'Newtonsoft.Json' 12.0.3 has a known high severity vulnerability, https://github.com/advisories/GHSA-5crp-9r3c-p9vr Top-level Package Requested Resolved Latest > Newtonsoft.Json 12.0.3 12.0.3 LATEST
The project asks for Newtonsoft.Json 12.0.3. The table shows it as a top-level package with the requested and resolved version 12.0.3 and the latest version on nuget.org; the example replaces that last number with LATEST because it changes whenever a new release appears. The NU1903 warning above the table comes from NuGet's package audit: 12.0.3 has a published high-severity advisory, which is one more reason to update it.
Options
| Command | What it does |
|---|---|
| dotnet list package | Every package reference with requested and resolved version |
| dotnet list package --outdated | Only packages with a newer version |
| dotnet list package --outdated --highest-minor | Only consider newer versions with the same major number |
| dotnet list package --outdated --highest-patch | Only consider newer patch versions |
| dotnet list package --outdated --include-prerelease | Compare with prerelease versions too |
| dotnet list package --include-transitive | Also indirect dependencies |
| dotnet list package --vulnerable | Packages with known vulnerabilities |
| dotnet list package --deprecated | Packages the author marked as deprecated |
| dotnet list package --format json | Machine-readable output for scripts and CI |
| dotnet list Shop.slnx package --outdated | Every project of a solution |
Updating what the list shows
Run dotnet add package NAME without --version to move a package to the latest stable version, or with --version for a specific one; see dotnet add package --version. Update major versions one at a time and read their release notes, since breaking changes are expected there. With Central Package Management, change the version in Directory.Packages.props instead.
Pitfalls
- Restore first. The command reads the restored assets file; on a fresh clone run
dotnet restore, otherwise it asks you to restore before listing. - Unreachable sources. If a source in
nuget.configis down or needs credentials, the check fails with NU1301 Unable to load the service index. - Floating versions. A reference such as
13.*shows the resolved version, which can change on every restore; pin versions if you want the outdated check to be meaningful. - Slow on large solutions. Every package is looked up on every source. Fewer sources and package source mapping make it faster.
How to confirm it worked
After updating, run dotnet list package --outdated again: a project with nothing to update prints that it has no updates for the given sources. In CI, --format json gives a stable output to fail a build when outdated or vulnerable packages appear.
FAQ
How do I update all outdated NuGet packages at once?
The CLI has no update-all command. Run dotnet add package NAME for each package in the list (which installs the latest version), or use the dotnet-outdated global tool, a third-party tool that can upgrade them in bulk.
How do I list vulnerable packages?
Run dotnet list package --vulnerable, and add --include-transitive to check indirect dependencies too. Recent SDKs also audit packages during restore and report NU1901 to NU1904 warnings.
Why does --outdated show nothing for a project I know is old?
Either everything is current, the project was not restored yet, or the configured sources do not contain newer versions. Run dotnet restore first and check the sources in nuget.config.