Recently I have noticed very strange thing with NuGet Package Manager in Visual Studio 2013 when was trying to restore missing packages for my asp.net mvc 5 web application. At this moment I have next Visual Studio:
Microsoft Visual Studio Ultimate 2013
Version 12.0.21005.1 REL
Microsoft .NET Framework
Installed Version: Ultimate
So, why visual studio does not restore packages? Let’s imagine, that we have our brand new, downloaded from repository, asp.net mvc web application and of course, at this moment, our application does not have obj, bin and packages folders. It’s really good practice do not store dll files in the repository as NuGet manager can pull all ones automatically by using packages.config.
If you open your application in Visual Studio and click “Build/Rebuild” button, you will see next popup:
It means that NuGet Package Manager is restoring missing dll libraries in your solution and unfortunately basically it fails, we have only one way at this moment, end Visual Studio process.
Note: sometimes, NuGet Manager can get all packages downloaded (after 5-10 min).
So, the main question why it happens? I do not know, but workaround is next:
Do not rebuild/build solution if you need restore some packages, just rigth click by solution
and select “Manage NuGet Packages for Solution…” menu item.
You will see next popup:
So, if you see: “some nuget packages are missing from this solution. click to restore…” message, this means that you have missing packages, just hit “Restore” button, and NuGet immediately will download missing packages without problems, that’s it!