{"id":1785,"date":"2020-11-13T08:26:02","date_gmt":"2020-11-13T16:26:02","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/dotnet\/?p=1785"},"modified":"2020-11-13T08:26:02","modified_gmt":"2020-11-13T16:26:02","slug":"getting-started-with-nuget-5-8","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/getting-started-with-nuget-5-8\/","title":{"rendered":"Getting Started With NuGet 5.8"},"content":{"rendered":"<h2>Getting started with NuGet 5.8<\/h2>\n<p>NuGet 5.8 is included in <a href=\"https:\/\/visualstudio.microsoft.com\/downloads\/\">Visual Studio 16.8<\/a> and .<a href=\"https:\/\/dotnet.microsoft.com\/download\/dotnet\/5.0\">NET 5.0<\/a> out of the box. You can also download NuGet 5.8 for Windows, macOS, and Linux as a <a href=\"https:\/\/dist.nuget.org\/win-x86-commandline\/v5.8.0\/nuget.exe\">standalone executable<\/a>.<\/p>\n<p>NuGet 5.8 is one of many releases in our .NET unification journey. Our NuGet tooling helps developers discover new .NET packages to use for their .NET applications, while making package management easier during your daily development.<\/p>\n<h2>NuGet 5.8 Highlights<\/h2>\n<p>There are many <a href=\"https:\/\/docs.microsoft.com\/nuget\/release-notes\/nuget-5.8\">important improvements in NuGet 5.8<\/a>:<\/p>\n<ul>\n<li>Create and use .NET 5 NuGet packages with <a href=\"#net-5-support\"><strong>.NET 5 Support<\/strong><\/a>.<\/li>\n<li>Faster package extraction by using <a href=\"#memorymappedfiles-for-faster-writes\"><strong>MemoryMappedFiles for Faster Writes<\/strong><\/a>.<\/li>\n<li>Search for packages using the <a href=\"#nuget-cli-search-command\"><strong>NuGet CLI Search Command<\/strong><\/a>.<\/li>\n<li>See faster NuGet restores with <a href=\"#no-op-restore-optimization\"><strong>No-Op Restore Optimization<\/strong><\/a>.<\/li>\n<li>Diagnose your package list with <a href=\"#dotnet-list-package-verbosity\"><strong>dotnet list package &#8211;verbosity<\/strong><\/a>.<\/li>\n<li>Install prerelease packages with <a href=\"#dotnet-add-package-prerelease\"><strong>dotnet add package &#8211;prerelease<\/strong><\/a>.<\/li>\n<li>Verify signed NuGet packages with <a href=\"#dotnet-nuget-verify\"><strong>dotnet nuget verify<\/strong><\/a>.<\/li>\n<li>Get to code faster with <a href=\"#nuget-solution-load-performance-improvements\"><strong>NuGet Solution Load Performance Improvements<\/strong><\/a>.<\/li>\n<li>Be more productive with <a href=\"#visual-studio-package-manager-improvements\"><strong>Visual Studio Package Manager Improvements<\/strong><\/a>.<\/li>\n<\/ul>\n<h3>.NET 5 Support<\/h3>\n<p>NuGet 5.8 is the first release to offer full authoring and restoring support for NuGet packages targeting .NET 5.0.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnet-1.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnet-1.png\" alt=\"Image dotnet\" width=\"227\" height=\"227\" class=\"aligncenter size-full wp-image-1788\" srcset=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnet-1.png 227w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnet-1-150x150.png 150w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnet-1-24x24.png 24w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnet-1-48x48.png 48w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnet-1-96x96.png 96w\" sizes=\"(max-width: 227px) 100vw, 227px\" \/><\/a><\/p>\n<p>If you aren\u2019t familiar with the .NET 5.0 target today or what it will look like in the future, don\u2019t forget to check out this great post by <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/the-future-of-net-standard\/\">Immo Landwerth on The Future of .NET Standard<\/a>.<\/p>\n<h3>MemoryMappedFiles for Faster Writes<\/h3>\n<p>By using <a href=\"https:\/\/en.wikipedia.org\/wiki\/Mmap\">mmap<\/a> for .nupkg extraction during restore, we&#8217;ve been able to improve the write speed of files holistically on Windows.<\/p>\n<p>For example, when running NuGet restore with mmap against the <a href=\"https:\/\/github.com\/OrchardCMS\/OrchardCore\">Orchard Core<\/a> project:<\/p>\n<h4>MMAP Improvements<\/h4>\n<table>\n<thead>\n<tr>\n<th>Client<\/th>\n<th>Scenario<\/th>\n<th>Time in Seconds<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>no mmap<\/td>\n<td>cold<\/td>\n<td>64&#046;08216<\/td>\n<\/tr>\n<tr>\n<td><strong>mmap<\/strong><\/td>\n<td><strong>cold<\/strong><\/td>\n<td><strong>22&#046;03339<\/strong><\/td>\n<\/tr>\n<tr>\n<td>no mmap<\/td>\n<td>warmup<\/td>\n<td>64&#046;58149<\/td>\n<\/tr>\n<tr>\n<td><strong>mmap<\/strong><\/td>\n<td><strong>warmup<\/strong><\/td>\n<td><strong>32&#046;60708<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>You&#8217;ll notice there is a 65% performance improvement for <strong>cold(Http Cache)<\/strong> and 50% performance improvement for <strong>warmup(No Http Cache)<\/strong> scenarios. We hope that you&#8217;ll enjoy these performance improvements when using NuGet 5.8.<\/p>\n<h3>NuGet CLI Search Command<\/h3>\n<p>Find NuGet packages quickly through the NuGet CLI with nuget search.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/nugetsearch-1-1.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/nugetsearch-1-1.png\" alt=\"Image nugetsearch\" width=\"922\" height=\"414\" class=\"aligncenter size-full wp-image-1807\" srcset=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/nugetsearch-1-1.png 922w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/nugetsearch-1-1-300x135.png 300w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/nugetsearch-1-1-768x345.png 768w\" sizes=\"(max-width: 922px) 100vw, 922px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/nugetsearchlogging-1.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/nugetsearchlogging-1.png\" alt=\"Image nugetsearchlogging\" width=\"1662\" height=\"1464\" class=\"aligncenter size-full wp-image-1806\" srcset=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/nugetsearchlogging-1.png 1662w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/nugetsearchlogging-1-300x264.png 300w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/nugetsearchlogging-1-1024x902.png 1024w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/nugetsearchlogging-1-768x677.png 768w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/nugetsearchlogging-1-1536x1353.png 1536w\" sizes=\"(max-width: 1662px) 100vw, 1662px\" \/><\/a><\/p>\n<p>To see additional examples, see the <a href=\"https:\/\/docs.microsoft.com\/en-us\/nuget\/reference\/cli-reference\/cli-ref-search\">documentation for nuget search<\/a>.<\/p>\n<h3>No-Op Restore Optimization<\/h3>\n<p>A no-op restore is when NuGet checks every project in a solution to ensure that nothing has changed &amp; determines whether a partial or full NuGet restore will be needed to install all of your dependencies.<\/p>\n<p>In NuGet 5.8 &amp; Visual Studio 16.8, we added optimizations to projects using <code>&lt;PackageReference&gt;<\/code>. This has brought significant gains to how long a no-op restore takes against an existing solution.<\/p>\n<p>For example, when running NuGet restore multiple times against the <a href=\"https:\/\/github.com\/OrchardCMS\/OrchardCore\">Orchard Core<\/a> project:<\/p>\n<h4>NuGet Restore<\/h4>\n<table>\n<thead>\n<tr>\n<th>Tool<\/th>\n<th>Version<\/th>\n<th>Restore<\/th>\n<th>Time in Seconds<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>dotnet CLI<\/td>\n<td>3&#046;1.402<\/td>\n<td>noop<\/td>\n<td>6&#046;929698<\/td>\n<\/tr>\n<tr>\n<td><strong>dotnet CLI<\/strong><\/td>\n<td><strong>5&#046;0.100<\/strong><\/td>\n<td><strong>noop<\/strong><\/td>\n<td><strong>5&#046;792257<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>You\u2019ll notice there is almost a <strong>15%+ performance improvement to no-op restores between .NET 3.1 &amp; .NET 5.0<\/strong>. Additionally, you\u2019ll see less of a difference between the performance of your no-op restore when restoring using other methods such as NuGet CLI, MSBuild, and Visual Studio.<\/p>\n<h3>dotnet list package &#8211;verbosity<\/h3>\n<p>You can now turn up the MSBuild verbosity level when listing packages for your project or solutions.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnetlistpackage-1-1.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnetlistpackage-1-1.png\" alt=\"Image dotnetlistpackage\" width=\"1392\" height=\"582\" class=\"aligncenter size-full wp-image-1805\" srcset=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnetlistpackage-1-1.png 1392w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnetlistpackage-1-1-300x125.png 300w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnetlistpackage-1-1-1024x428.png 1024w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnetlistpackage-1-1-768x321.png 768w\" sizes=\"(max-width: 1392px) 100vw, 1392px\" \/><\/a><\/p>\n<p>To see additional examples, see the <a href=\"https:\/\/docs.microsoft.com\/dotnet\/core\/tools\/dotnet-list-package\">documentation for <code>dotnet list package<\/code><\/a>.<\/p>\n<h3>dotnet add package &#8211;prerelease<\/h3>\n<p>The dotnet add package command installs the latest stable version by default. You can now install the absolute latest version if you include the &#8211;prerelease option.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnetaddpackage-2-1.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnetaddpackage-2-1.png\" alt=\"Image dotnetaddpackage\" width=\"1410\" height=\"540\" class=\"aligncenter size-full wp-image-1814\" \/><\/a><\/p>\n<p>To see additional examples, see the <a href=\"https:\/\/docs.microsoft.com\/dotnet\/core\/tools\/dotnet-add-package\">documentation for dotnet add package<\/a>.<\/p>\n<h3>dotnet nuget verify<\/h3>\n<p>You can now verify a NuGet package that has been signed within the dotnet CLI. In the future, you will be able to sign a NuGet package with the dotnet CLI.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnetnugetverify-1-1.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnetnugetverify-1-1.png\" alt=\"Image dotnetnugetverify\" width=\"1056\" height=\"540\" class=\"aligncenter size-full wp-image-1809\" srcset=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnetnugetverify-1-1.png 1056w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnetnugetverify-1-1-300x153.png 300w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnetnugetverify-1-1-1024x524.png 1024w, https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2020\/11\/dotnetnugetverify-1-1-768x393.png 768w\" sizes=\"(max-width: 1056px) 100vw, 1056px\" \/><\/a><\/p>\n<p>To see additional examples, see the <a href=\"https:\/\/docs.microsoft.com\/dotnet\/core\/tools\/dotnet-nuget-verify#examples\">documentation for <code>dotnet nuget verify<\/code><\/a>.<\/p>\n<h3>NuGet Solution Load Performance Improvements<\/h3>\n<p>You may have encountered the dreadful delay of loading big solutions in Visual Studio. Much of that time can be dedicated to loading your projects and restoring your packages when you first open your solution. In NuGet 5.8, we improved 2 main areas:<\/p>\n<ol>\n<li>We\u2019ve reduced the amount of <a href=\"https:\/\/docs.microsoft.com\/nuget\/reference\/errors-and-warnings\/nu1105\">NU1105<\/a> errors you see when loading your solutions in Visual Studio.<\/li>\n<li>We\u2019ve improved no-op restore performance by 10%+ when loading a solution.<\/li>\n<\/ol>\n<p>Let us know if you see less errors &amp; a faster solution load experience with NuGet!<\/p>\n<h3>Visual Studio Package Manager Improvements<\/h3>\n<p>In NuGet 5.8 &amp; Visual Studio 2019 16.8, we addressed a problem in which projects are continuously restored. We optimized this to only restore once while also running in parallel. You should notice your NuGet Package Manager UI to perform much more quickly as a result. In fact, you may see somewhere <strong>between a 2-14x faster experience when using the NuGet Package Manager UI<\/strong> with more optimizations coming soon.<\/p>\n<p>We\u2019ve also improved your experience when using the consolidate and update package operations. Instead of having to try several times to upgrade or downgrade a package version, we\u2019ve improved the reliability to ensure that you only have to do this operation once to restore correctly.<\/p>\n<p>Finally, we\u2019ve made it much faster to uninstall packages for large solutions. For example, a project such as <a href=\"https:\/\/github.com\/OrchardCMS\/OrchardCore\">Orchard Core<\/a> includes 158 projects in a solution. To uninstall packages in this solution previously would take around 70s. <strong>We\u2019ve improved this performance by 2x so it only takes 30s for 158 projects<\/strong>. You will also see this improvement for your smaller solutions where a small solution with 4 projects might take 1s to uninstall. It now will only take 0.75s.<\/p>\n<h2>Known Issues<\/h2>\n<p>Because NuGet 5.8 is the first release to support .NET 5, we consider it to be a known issue that your builds can break when using it with other tooling versions. You may run into issues with restoring your projects &amp; solutions and then building them using mismatched versions of tooling.<\/p>\n<p>One such issue you may run into is <a href=\"https:\/\/developercommunity.visualstudio.com\/content\/problem\/1248649\/error-netsdk1005-assets-file-projectassetsjson-doe.html\">NETSDK1005<\/a>. This happens when you restore packages using an earlier NuGet tooling version &amp; building your projects &amp; solutions with a newer tooling version of Visual Studio, dotnet CLI, or MSBuild.<\/p>\n<p><strong>It is advised to ensure that you are on the same version of tooling in your environments. Visual Studio 16.8, MSBuild 16.8, and .NET 5.0 require NuGet 5.8 or later.<\/strong><\/p>\n<p>One such way of ensuring you have the same version of tooling being used in your environments is to use MSBuild, Visual Studio, or the dotnet CLI. You can get started with NuGet restore in each of these scenarios in the following way:<\/p>\n<ul>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/nuget\/consume-packages\/package-restore#restore-using-msbuild\">MSBuild restore<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/nuget\/consume-packages\/package-restore#restore-using-visual-studio\">Visual Studio<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/nuget\/consume-packages\/package-restore#restore-using-the-dotnet-cli\">dotnet restore<\/a><\/li>\n<\/ul>\n<h2>Closing<\/h2>\n<p>NuGet 5.8 is a big release that should improve many aspects of your daily package management needs. We\u2019ve added a broad set of improvements to our CLI experiences, improved performance to restore &amp; solution load, and added support for .NET 5!<\/p>\n<p>We\u2019re excited to see you use NuGet 5.8 &amp; include it in your toolset for building amazing things with .NET.<\/p>\n<p>For more details on NuGet 5.8, see our <a href=\"https:\/\/docs.microsoft.com\/nuget\/release-notes\/nuget-5.8\">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 report a <a href=\"\/\/github.com\/NuGet\/Home\/issues\/new\">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 <strong>Help &gt; Report a Problem<\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>NuGet 5.8 is one of many releases in our .NET unification journey. Our NuGet tooling helps developers discover new .NET packages to use for their .NET applications, while making package management easier during your daily development.<\/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,7928,7930,646],"tags":[30,7947,104,7848],"class_list":["post-1785","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-feature-announcement","category-nuget","category-other-announcements","category-release-announcement","category-visual-studio","tag-announcement","tag-microsoft","tag-nuget","tag-nuget-org"],"acf":[],"blog_post_summary":"<p>NuGet 5.8 is one of many releases in our .NET unification journey. Our NuGet tooling helps developers discover new .NET packages to use for their .NET applications, while making package management easier during your daily development.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/1785","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=1785"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/1785\/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=1785"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=1785"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=1785"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}