How to enable nugets package restore in Visual Studio 2015?

NugetVisual Studio-2015Nuget Package-Restore

Nuget Problem Overview


How do I enable the nuget package restore feature in Visual Studio 2015?

The feature is just missing in my context menu (Yes - I've double checked that I try it on the solution instead of a project)

My only project is a .NET 4.5 console application - there is no .nuget folder yet. There is an actual nuget package installed.

Nuget Solutions


Solution 1 - Nuget

I had the same problem as you and the way I solved it was to delete the packages folder from my solution and also bin and obj folders from every project in the solution and give it a rebuild.

Solution 2 - Nuget

As it turns out, the real solution is to migrate to Automatic Package Restore. We experienced issues with NuGet after upgrading to VS 2015 after working in 2013 for a while. Turns out the old way of doing NuGet completely hoses the new way of doing it.

The solution is simple, though tedious. Apparently the NuGet.targets file signals VS to use the old NuGet way of doing things, and it's absence means that you are now using "Automatic Package Restore". You can migrate to Automatic Package Restore by following these steps:

  1. Delete .nuget/NuGet.exe
  2. Delete .nuget/NuGet.targets
  3. For each project:
  4. Unload the project
  5. Right click -> Edit the project
  6. Delete all references to the NuGet.targets file, i.e. the following:

> true
...
...
This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.

There is also a powershell script that will perform the migration for you, if you are feeling bold. You can find it on github.

Solution 3 - Nuget

For others this option is available in the Nuget settings section in Visual Studio Options

enter image description here

Solution 4 - Nuget

I had problem with restoring package with error 401 unauthorised. I found the solution by unchecking available local package sources. Debug > Options > NuGet Package Manager > Package Sources

Only allow nuget.org packages

Solution 5 - Nuget

My Visual Studio 2015 Professional was installed using the default settings. The options for "Allow NuGet to download missing packages" and "Automatically check for missing packages during build in Visual Studio" were already checked by default, but I still could not download the packages. I was getting an error that a package version could not be found.

I needed to click a checkbox under Tools > Options > NuGet Package Manager > Package Sources to enable NuGet Package Restore to work as expected.

enter image description here

Solution 6 - Nuget

I had a problem with accessing the packages folder after starting Visual Studio 2015 in Administrator mode, so I deleted it with the intention of performing a restore.

But no restore was performed when rebuilding the solution, and there was no Restore Packages to be found at the solution level or in the Nuget window.

However, if you right-click the References nodes on the projects in the solution, there is a Restore Packages option. Running this on all projects fixed it for me.

Solution 7 - Nuget

enter image description here

Well it is pretty simple with VS2015, all i had to do was to right click on my project solution and click on restore nuget.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionboopView Question on Stackoverflow
Solution 1 - NugetMartin ShishkovView Answer on Stackoverflow
Solution 2 - NugetBinaryTox1nView Answer on Stackoverflow
Solution 3 - NugetEric HerlitzView Answer on Stackoverflow
Solution 4 - NugetMeghaView Answer on Stackoverflow
Solution 5 - NugetlaylareneeView Answer on Stackoverflow
Solution 6 - NugetDaniel PerssonView Answer on Stackoverflow
Solution 7 - NugetMilo JoeView Answer on Stackoverflow