{"id":2681,"date":"2023-02-28T08:29:59","date_gmt":"2023-02-28T16:29:59","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/dotnet\/?p=2681"},"modified":"2023-02-28T08:29:59","modified_gmt":"2023-02-28T16:29:59","slug":"announcing-nuget-6-5-the-sweetest-way-to-manage-your-packages","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-nuget-6-5-the-sweetest-way-to-manage-your-packages\/","title":{"rendered":"Announcing NuGet 6.5 \u2013 The Sweetest Way to Manage Your Packages"},"content":{"rendered":"<p>NuGet 6.5 is included in <a href=\"https:\/\/visualstudio.microsoft.com\/downloads\/\">Visual Studio 2022<\/a> and <a href=\"https:\/\/dotnet.microsoft.com\/download\/dotnet\/7.0\">.NET 7.0<\/a> out of the box. You can also download NuGet 6.5 for Windows, macOS, and Linux as a <a href=\"https:\/\/dist.nuget.org\/win-x86-commandline\/v6.5.0\/nuget.exe\">standalone executable<\/a>.<\/p>\n<p>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.<\/p>\n<h2>NuGet 6.5 Highlights<\/h2>\n<p>There are many <a href=\"https:\/\/docs.microsoft.com\/nuget\/release-notes\/nuget-6.5\">new features in NuGet 6.5<\/a>:<\/p>\n<ul>\n<li><a href=\"#streamlined-package-management-inside-visual-studio-with-directory-packages-props-support\">Streamlined package management inside Visual Studio with Directory.Packages.props support.<\/a><\/li>\n<li><a href=\"#list-create-and-remove-package-source-mappings-inside-nuget-options-within-visual-studio\">List, create, and remove package source mappings inside NuGet options within Visual Studio.<\/a><\/li>\n<li><a href=\"#nuget-now-uses-server-provided-retry-after-delay-on-http-429-responses\">NuGet now uses server-provided Retry-After delay on HTTP 429 responses.<\/a><\/li>\n<li><a href=\"#dotnet-list-package-now-supports-machine-readable-output-in-json-formats\">dotnet list package now supports machine readable output in JSON formats.<\/a><\/li>\n<li><a href=\"#warningsnotaserrors-now-supports-nuget-warnings\">WarningsNotAsErrors now supports NuGet warnings.<\/a><\/li>\n<li><a href=\"#visual-studio-now-reloads-package-sources-when-a-nuget-config-is-modified-outside-the-ide\">Visual Studio now reloads package sources when a nuget.config is modified outside the IDE.<\/a><\/li>\n<li><a href=\"#dependencies-can-be-restored-for-projects-listed-in-a-solution-filter-file-slnf-with-nuget-exe\">Dependencies can be restored for projects listed in a solution filter file (.slnf) with NuGet.exe.<\/a><\/li>\n<\/ul>\n<h2>Streamlined package management inside Visual Studio with Directory.Packages.props support<\/h2>\n<p><a href=\"https:\/\/learn.microsoft.com\/nuget\/consume-packages\/Central-Package-Management\">Central package management<\/a> 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 <code>Directory.Packages.props<\/code> file and supports common package management operations like installing and updating packages defined there.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2023\/02\/cpm-1.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2023\/02\/cpm-1-550x350.png\" alt=\"Image cpm\" width=\"550\" height=\"350\" class=\"aligncenter size-medium wp-image-2682\" \/><\/a><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2023\/02\/cpm2-1.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2023\/02\/cpm2-1-560x183.png\" alt=\"Image cpm2\" width=\"560\" height=\"183\" class=\"aligncenter size-medium wp-image-2683\" \/><\/a><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2023\/02\/cpm3-1.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2023\/02\/cpm3-1-560x325.png\" alt=\"Image cpm3\" width=\"560\" height=\"325\" class=\"aligncenter size-medium wp-image-2684\" \/><\/a><\/p>\n<h2>List, create, and remove package source mappings inside NuGet options within Visual Studio<\/h2>\n<p>Managing your <a href=\"https:\/\/learn.microsoft.com\/nuget\/consume-packages\/package-source-mapping\">package source mappings<\/a> can be quite a challenge in a <code>nuget.config<\/code> file. We\u2019ve added a new NuGet options menu to help you manage your mappings that will be written to your respective configuration.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2023\/02\/packagesourcemapping-1.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2023\/02\/packagesourcemapping-1-515x350.png\" alt=\"Image packagesourcemapping\" width=\"515\" height=\"350\" class=\"aligncenter size-medium wp-image-2686\" \/><\/a><\/p>\n<h2>NuGet now uses server-provided Retry-After delay on HTTP 429 responses<\/h2>\n<p>A busy HTTP server may respond with an HTTP 429 response, including a <code>Retry-After<\/code> 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&#8217;s <code>Retry-After<\/code> duration. There are environment variables that can limit the duration NuGet will wait in case a server requests an unreasonably long retry duration.<\/p>\n<p><em>Example:<\/em> <code>NUGET_MAX_RETRY_AFTER_DELAY_SECONDS<\/code> sets the maximum duration between retries when HTTP response contains <code>Retry-After<\/code> header.<\/p>\n<h2>dotnet list package now supports machine readable output in JSON formats<\/h2>\n<p>One major challenge you have with <code>dotnet list package<\/code> 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.<\/p>\n<p>Here\u2019s a quick way on how you can do just that.<\/p>\n<p><code>dotnet list package --format json &gt; dependencies.json<\/code><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2023\/02\/dotnetlistpackage-1.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2023\/02\/dotnetlistpackage-1-261x350.png\" alt=\"Image dotnetlistpackage\" width=\"261\" height=\"350\" class=\"aligncenter size-medium wp-image-2685\" \/><\/a><\/p>\n<h2>WarningsNotAsErrors now supports NuGet warnings<\/h2>\n<p>When certain package or project issues are detected, NuGet generates coded warnings that can be elevated to errors <code>(TreatWarningsAsErrors)<\/code> or completely suppressed <code>(NoWarn)<\/code>.<\/p>\n<p>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.<\/p>\n<p>To opt-in to this behavior, you can add the warning code in question to the <code>&lt;WarningsNotAsErrors&gt;<\/code> property.<\/p>\n<p><em>Example:<\/em> <code>&lt;WarningsNotAsErrors&gt;$(WarningsNotAsErrors);NU1603&lt;\/WarningsNotAsErrors&gt;<\/code><\/p>\n<h2>Visual Studio now reloads package sources when a nuget.config is modified outside the IDE<\/h2>\n<p>Instead of having to re-load Visual Studio or the solution to reflect any package source changes made to <code>nuget.config<\/code> 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.<\/p>\n<h2>Dependencies can be restored for projects listed in a solution filter file (.slnf) with NuGet.exe.<\/h2>\n<p>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.<\/p>\n<p>When a solution filter file is used with <code>NuGet.exe<\/code>, 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.<\/p>\n<h2>Closing<\/h2>\n<p>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.<\/p>\n<p>So, sit back, relax, and indulge in the sweetness that is NuGet. We can\u2019t wait to see what you create with it.<\/p>\n<p>On behalf of the NuGet team and the entire .NET community, we&#8217;d like to express our sincere gratitude to all the <a href=\"https:\/\/learn.microsoft.com\/nuget\/release-notes\/nuget-6.5#community-contributions\">community contributors<\/a> who have generously given their time and expertise to improve NuGet this release. Thank you.<\/p>\n<p>For more details on NuGet 6.5, see our <a href=\"https:\/\/docs.microsoft.com\/nuget\/release-notes\/nuget-6.5\">official release notes<\/a>.<\/p>\n<h2>Feedback<\/h2>\n<p>Your feedback is important to us. If there are any problems with this release, check our <a href=\"https:\/\/github.com\/NuGet\/Home\/issues\">GitHub Issues<\/a> and <a href=\"https:\/\/developercommunity.visualstudio.com\/\">Visual Studio Developer Community<\/a> for existing issues. For new issues within NuGet, please <a href=\"https:\/\/github.com\/NuGet\/Home\/issues\/new\/choose\">report a GitHub Issue<\/a>. For general NuGet experience issues, let us know via the <a href=\"https:\/\/docs.microsoft.com\/visualstudio\/ide\/how-to-report-a-problem-with-visual-studio\">Report a Problem<\/a> option found in your favorite IDE under <code>Help &gt; Report a Problem<\/code>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":551,"featured_media":1801,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[7933,7874,7930,646],"tags":[7970,7998,104,7999,7976,147],"class_list":["post-2681","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-feature-announcement","category-nuget","category-release-announcement","category-visual-studio","tag-central-package-management","tag-dotnet-list-package","tag-nuget","tag-nuget-6-5","tag-package-source-mapping","tag-visual-studio"],"acf":[],"blog_post_summary":"<p>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 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/2681","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/551"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=2681"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/2681\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/1801"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=2681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=2681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=2681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}