Nuget and Package Restore

Mar 17, 2012 at 12:46 AM
Edited Mar 17, 2012 at 12:55 AM

I’ve been running into problems with a few of my projects where I shuffle assemblies around frequently – basically for dev I pull in full projects to work with, but then when ready to push out these projects I add the final assemblies as NuGet references. So I often end up removing and re-adding assemblies in various projects with some of these assemblies fed from NuGet.

This process of dealing with package restore with NuGet is painful and unobvious I think. It’s possible I’m missing something… but I think there’s needs to be an easier way in the UI or even via the Package Manager Console to just check and EXPLICITLY force a reload of all NuGet packages defined for a project. Something like Validate-Packages or Reload-Packages. Even better maybe this should be automatic if an assembly can’t be found.

Specifically if I remove an assembly (for whatever stupid reason or by accident <s>) it doesn’t automatically restore it even with Enable Package Restore enabled when recompiling. The only thing that works seems to be to remove all of the Packages folder, which then triggers the reload. Or if I go to the package manager UI the only option I seem to have is to uninstall and then reinstall from the repository. Neither of these is very efficient nor obvious.

It seems this should be a basic feature of a package store. I think it’d also be nice if there was a more obvious way to replace a package with a newer version. I can do this by editing packages.config but again – making a change here doesn’t actually download the new package either.

What would be really nice if the UI had a list of all the packages installed with easy links to Update to latest version or Reload existing and uninstall. Currently the list is there but you can only uninstall...

Am I missing some easy way to do an explicit restore? Is anybody else ever running into this scenario or is this just my odd setup with these particular projects? (yes! I know, but I think this should still work).

+++ Rick ---

Mar 20, 2012 at 3:00 PM

c:\apps> c:\Utils\NuGet.exe install MvcApplication46\MvcApplication46\packages.config -OutputDirectory MvcApplication46\packages\

By this way, you may force it AFAIK but never tried something similar to your solution.