3

I am having serious problems getting Solutions to build in Visual Studios 2015. Before I would just click "Enable NuGet Package Restore" in Visual Studios 2013 and everything comes in just fine.

I see this exact same question how-to-enable-nugets-package-restore-in-vs-2015

the answer was:

delete the packages folder from my solution and also bin and obj folders from every project in the solution and give it a rebuild.

pardon my French, but besides this being bullshit. The fact that you have to manually go into every single project in your solution and mess around , it also is not working for me. Maybe the guy that wrote this had 3 or 4 projects , I have 30+ that are referenced.

That was back in June , has anyone found a working or simpler way to achieve this functionality that was working perfectly prior to VS 2015?

Community
  • 1
  • 1
Scott Selby
  • 9,420
  • 12
  • 57
  • 96
  • The original notion of nuget package restores was poorly thought out and a giant misexecution...as are most things Microsoft does. The downstream effect is that you need to expect massive breaking changes when they realize just how bad an idea they had in the previous iteration. – Jeff Oct 30 '15 at 03:56
  • yea, but the way most source control by default ignores most of the references you need , having them all pulled in upon build did work. Whether it was good or not , or well thought out or not at least it worked, now I have to open a solution with VS 2013 let VS pull in all references , then I can use VS 2015 with that solution , that is just horrible. – Scott Selby Oct 30 '15 at 03:58
  • 1
    Open all project files in an editor such as notepad++ and simply replace the NuGet.targets line with empty should do the trick, and then you are free of MSBuild based package restore and should use `nuget restore your solution` to restore them at command prompt or directly by VS. – Lex Li Oct 30 '15 at 04:21
  • 1
    The second answer to [the question you referenced](http://stackoverflow.com/questions/28131095/how-to-enable-nugets-package-restore-in-visual-studio-2015) has a (use at your own risk) [link](https://docs.nuget.org/consume/package-restore/migrating-to-automatic-package-restore) to automate the steps mentioned by @LexLi – Mike Oct 30 '15 at 04:23

1 Answers1

2

This setting is on by default since NuGet 2.7. Use a small Powershell script to migrate from the old MSBuild to the automatic restore of 2.7 to fix your issues.

When a package is not installed you see this dialog at start of the build process where NuGet restores the missing package:

enter image description here

magicandre1981
  • 27,895
  • 5
  • 86
  • 127
  • This looks like it will work, as far as the NuGet option "Automatically Check For Missing Packages During Build" option being set by default.... that does nothing as far as I've seen. It is not the same as hitting the old "Enable NuGet Package Restore" option that used to be there – Scott Selby Oct 30 '15 at 06:47
  • this option is **SET** as on by default and if you don't like it, you can opt out from it. It does want you want. When you try to build a solution you see this dialog: http://i.stack.imgur.com/EVHfl.png – magicandre1981 Oct 31 '15 at 07:30