Announcing NuGet 6.5 – The Sweetest Way to Manage Your Packages

Jon Douglas

Nikolche Kolev

NuGet 6.5 is included in Visual Studio 2022 and .NET 7.0 out of the box. You can also download NuGet 6.5 for Windows, macOS, and Linux as a standalone executable.

Tired of the sour taste of managing packages? NuGet 6.5 brings a new flavor of seamless central package management, simple package source mapping management, useful JSON machine readable output, and helpful Visual Studio additions.

NuGet 6.5 Highlights

There are many new features in NuGet 6.5:

Streamlined package management inside Visual Studio with Directory.Packages.props support

Central package management has been proven to be a helpful way of centralizing package dependencies saving you time and reducing the risk of errors. Now in Visual Studio, the NuGet package manager is aware of the Directory.Packages.props file and supports common package management operations like installing and updating packages defined there.

Image cpm

Image cpm2

Image cpm3

List, create, and remove package source mappings inside NuGet options within Visual Studio

Managing your package source mappings can be quite a challenge in a nuget.config file. We’ve added a new NuGet options menu to help you manage your mappings that will be written to your respective configuration.

Image packagesourcemapping

NuGet now uses server-provided Retry-After delay on HTTP 429 responses

A busy HTTP server may respond with an HTTP 429 response, including a Retry-After header that asks clients to wait a certain duration before retrying. Earlier versions of NuGet would not retry 429 responses, and now NuGet will retry and use the server’s Retry-After duration. There are environment variables that can limit the duration NuGet will wait in case a server requests an unreasonably long retry duration.

Example: NUGET_MAX_RETRY_AFTER_DELAY_SECONDS sets the maximum duration between retries when HTTP response contains Retry-After header.

dotnet list package now supports machine readable output in JSON formats

One major challenge you have with dotnet list package is that it is hard to audit and parse the output. Now within the latest .NET SDK, you can output to a machine-readable format such as JSON.

Here’s a quick way on how you can do just that.

dotnet list package --format json > dependencies.json

Image dotnetlistpackage

WarningsNotAsErrors now supports NuGet warnings

When certain package or project issues are detected, NuGet generates coded warnings that can be elevated to errors (TreatWarningsAsErrors) or completely suppressed (NoWarn).

It is uncommon for projects to be configured to treat warning as errors. In some special cases, a warning may not be considered critical. Instead of completely suppressing the warning, you may choose to keep the warning visible, but not fail the entire build.

To opt-in to this behavior, you can add the warning code in question to the <WarningsNotAsErrors> property.

Example: <WarningsNotAsErrors>$(WarningsNotAsErrors);NU1603</WarningsNotAsErrors>

Visual Studio now reloads package sources when a nuget.config is modified outside the IDE

Instead of having to re-load Visual Studio or the solution to reflect any package source changes made to nuget.config files outside the context of Visual Studio, the NuGet package manager UI will now detect these changes if you were to make changes with your favorite text editor, dotnet CLI, or other tool.

Dependencies can be restored for projects listed in a solution filter file (.slnf) with NuGet.exe.

A solution filter file is a JSON file that allows developers to filter the set of projects that are loaded with a solution. When a solution filter file is used, only the projects that match the filter criteria will be loaded, which can help to speed up solution load times for large solutions.

When a solution filter file is used with NuGet.exe, it will only load the projects that are included in the filter, which means that NuGet dependences for excluded projects will not be restored by default. Now these dependencies can be restored for any dependency projects and their packages.

Closing

NuGet 6.5 is a sweet release filled with enhancements to central package management, machine-readable output, and package source mapping. NuGet is truly a treat for developers everywhere.

So, sit back, relax, and indulge in the sweetness that is NuGet. We can’t wait to see what you create with it.

On behalf of the NuGet team and the entire .NET community, we’d like to express our sincere gratitude to all the community contributors who have generously given their time and expertise to improve NuGet this release. Thank you.

For more details on NuGet 6.5, see our official release notes.

Feedback

Your feedback is important to us. If there are any problems with this release, check our GitHub Issues and Visual Studio Developer Community for existing issues. For new issues within NuGet, please report a GitHub Issue. For general NuGet experience issues, let us know via the Report a Problem option found in your favorite IDE under Help > Report a Problem.

7 comments

Discussion is closed. Login to edit/delete existing comments.

  • MgSam 2

    Are there any plans to build dotnet nuget and nuget.exe into feature parity at some point? It’s super confusing having two ways to do some of the same things yet each havs different feature sets and ways of operating.

    • Jon DouglasMicrosoft employee 1

      We are working on feature parity every release. Are there specific missing features you have in mind? We have active proposals we’d love your feedback on.

  • Craig Johnson 0
    nuget update -self

    is not updating – still on 6.4.0. Will the CLI also be updated?

    • Jon DouglasMicrosoft employee 1

      Apologies in advance, we typically wait a couple weeks to ensure no major breaks before promoting the recommended version on https://www.nuget.org/downloads

  • Dominik Jeske 0

    It is nice to see that nuget is live again 🙂

    • Jon DouglasMicrosoft employee 1

      Thank you for the kind note!

  • reduckted 1

    It is uncommon for projects to be configured to treat warning as errors.

    I think you might mean it’s not uncommon. 🙂

Feedback usabilla icon