30

I have two projects ones a class library and ones an mvc3 project. They both have nuget packages associated with them. On the class library when I right click the solution I get the "Enable NuGet Packges Restore" option

enter image description here

In the MVC one I do not.

enter image description here

needless to say I would like the feature for both projects. what am I doing wrong?

Xavier Decoster
  • 14,580
  • 5
  • 35
  • 46
Raif
  • 8,641
  • 13
  • 45
  • 56

2 Answers2

39

The NuGet package restore context menu item is hidden when the extension detects the presence of a $(SolutionDir).nuget folder containing the nuget.exe, nuget.config and nuget.targets needed to perform package restore.

The MVC app already has these, so restore should be enabled. If not, simply delete the .nuget folder and you'll see the menu item reappear.

Xavier Decoster
  • 14,580
  • 5
  • 35
  • 46
  • Sweet! That did it! I deleted the .nuget folder, removed it from the solution, and presto there's the enable option again. Now I would kind of like to know where in what config file something is being set because as you can see from the pics above VS lost track of something because it was not showing the option and not restoring the references. None the less works now. Thank you very much. – Raif Mar 15 '13 at 16:11
  • 1
    The NuGet VSIX simply checks for existance of these files. No setting involved AFAIK. If it was not restoring, then that's likely because the project file(s) was missing the nuget.targets import at the bottom (and also requires the true MSBuild Property to be set). – Xavier Decoster Mar 15 '13 at 19:47
  • Mine is missing and I do not have a nuget folder in my solution dir. I do not have nuget.config, nuget.exe, or nuget.targets either. I never did, and it's not showing up.. What I did do though is migrate form VS2013 to VS2015 recently, now nothing works.. All my nuget stuff is broken. – Ryan Mann Jul 29 '15 at 15:17
  • 1
    Hmm, in vs2015, I went to options -> getget package manager and unhcecked Allow nuget.. and automatically check... Rebuilt my solution, turned them back on, cleaned, and rebuilt again, everything works now... no idea why, very fishy. – Ryan Mann Jul 29 '15 at 15:20
2

For me it was as simple as:

"Manage NuGet Packages for Solution" -> "Restore" (top right of dialog)

Kinetic
  • 700
  • 8
  • 15