Safeguard
Developer Tools•

dotnet list package vulnerable or NuGet Audit: which should I use?

NuGet Audit warns on every restore, while dotnet list package vulnerable gives an on demand report. Use both, for different jobs. Here is how they differ.

Safeguard Security Team
3 min read

Use both, for different jobs. NuGet Audit runs automatically on restore and gives developers and CI an immediate warning. The dotnet list package command with the vulnerable option produces an on demand report, including transitive packages and JSON output, that suits scheduled reviews and evidence.

Side by side

QuestionNuGet AuditList package, vulnerable
When does it run?Every restoreWhen you run the command
OutputWarnings NU1901 to NU1904 in the build logA report by project and framework
Transitive packagesControlled by NuGetAuditModeOnly with the include transitive option
Machine readableBuild logJSON with the format option
Can fail the buildYes, with WarningsAsErrorsOnly if you script it
NeedsNuGet 6.8 and the .NET 8 SDK for PackageReference.NET 5 SDK 5.0.200 and later

Dates in the right column come from Microsoft's feature availability table. The vulnerable option uses your audit sources from .NET SDK 9.0.300.

What the report is good for

dotnet list package --vulnerable --include-transitive --format json > report.json

Microsoft notes that transitive packages are not included by default, so add the option. The JSON output is useful for storing with a release, diffing week to week, or feeding another tool. The vulnerable option cannot be combined with deprecated or outdated in the same run.

What audit on restore is good for

It catches problems at the moment a developer adds or updates a package, and again on every CI restore. Because it is a warning with a code, you can promote chosen severities to errors and keep the rest advisory.

A setup that uses both

  1. Enable NuGet Audit at the repository level, with mode set to all.
  2. In ordinary CI builds, leave audit warnings non blocking.
  3. In a dedicated audit pipeline, turn NU1903 and NU1904 into errors.
  4. Schedule the list command nightly with JSON output and store the artifact.
  5. Review changes in the report, and open tickets for new findings.
  6. Prove audit ran by comparing audited and project counts in a solution targets file.

Shared limits

Both use advisory data from your audit sources, which for nuget.org comes from the GitHub Advisory Database. Both tell you a known issue exists in a version. Neither tells you whether your code reaches the vulnerable function, nor whether a fix is safe to apply. Also note the metadata lookup caveat for list package: package source mapping does not apply, so package IDs go to every configured source.

Try it yourself

Click through it at your own pace, or open it full screen. Compare a single finding view with the aggregate report view.

Safeguard combines dependency scanning, reachability analysis and fix pull requests in one workflow, and a free scan shows how it reads a NuGet project.

Quick check

Do I need dotnet list package if NuGet Audit is on?

Not strictly, but the report gives a stored, machine readable record that restore warnings do not.

Does the list command include transitive packages by default?

No. Add the include transitive option.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.