How to upgrade NuGet with Visual Studio 2017?

12,852

How to Upgrade NuGet with Visual Studio 2017

That because you have a .nuget folder at solution level, that folder contains an old (2.8.x) nuget.exe file. A lot of packages might need new version of that file. You should update it:

  1. Open this link: https://www.nuget.org/downloads, switch to the Windows x86 Commandline tab, download 3.3 or above.
  2. Download latest version of nuget.exe
  3. Replace your .nuget/nuget.exe with this new version.

And try again.

Besides, your solution is using an old nuget restore method that has been deprecated. Automatic Package Restore is the NuGet team's recommended approach to Package Restore within Visual Studio, and it was introduced in NuGet 2.7. Beginning with NuGet 2.7, the NuGet Visual Studio extension integrates into Visual Studio's build events and restores missing packages when a build begins.

See this thread NuGet auto package restore does not work with MSBuild and Nuget: Switching from "Enable Package Restore" to "Automatic Package Restore" for some more details.

Hope this helps.

Share:
12,852
Bob Horn
Author by

Bob Horn

I'm a software developer that is passionate about elegant, quality code.

Updated on June 30, 2022

Comments

  • Bob Horn
    Bob Horn almost 2 years

    I'm getting a build error that I need to upgrade NuGet:

    The 'Microsoft.NETCore.Platforms 1.1.0' package requires NuGet client version '2.12' or above, but the current NuGet version is '2.8.60318.667'.

    From what I've found online, within VS, I'm supposed to go to Tools > Extensions and Updates. And I'm supposed to see an option to upgrade NuGet within the Updates tab. As you can see, that option isn't there:

    enter image description here

    My solution has a .nuget folder, and it has NuGet.exe in it, which has a version of 2.8.x. How can I upgrade to 2.12?