Custom package how-to question

Topics: General
Dec 22, 2012 at 7:20 AM

I'd like to find a way to have my nuget packages downloaded automatically if they are found to be out of date or non-existent in the solution. Preferably such a download would occur either at open or build of the solution.

My company has several different products with dependencies to dozens of 3rd party vendor components. We currently manage those dependencies by using relative path references in the projects and known sets of assemblies. Developers copy an "assembly" folder from a standard location to the solution folder when they pull a new file set from source control. Everything then compiles against that copied reference set and they can continue working.

I'm hoping to use nuget in such a fashion that the configuration files will be saved to source control but the actual assemblies will not. Then when a new developer gets latest from source control the latest package config is pulled and on solution open/build any missing or out of date assemblies would be copied to the packages directory.

I'm sure there must be ways to accomplish this but as a nuget newb (is that a nub?) I haven't figured it out yet.

Any suggestions you might have will be greatly appreciated.

Dec 26, 2012 at 7:14 PM

What you need to do is to simply enable the package restore mode on your solution. Here's how:

http://docs.nuget.org/docs/workflows/using-nuget-without-committing-packages

Dec 28, 2012 at 5:39 AM

That's exactly what I was hoping to find.

Thanks

Dec 28, 2012 at 2:05 PM

Just one quick follow up to this because I had a similar question and issue here.  Package restore will not automatically update the package to a newer version.  I will restore it if it is missing.   There have been some people that proposed some solutions to the notification that packages are out of date using the powershell capabilities that nuget offers (http://stackoverflow.com/questions/11050030/create-a-nuget-package-that-shows-update-notifications).  But I'd watch that because you don't want to be throwing out messages during a build or something that halts the process. I haven't seen an alternate solution other than opening up the package manager GUI and checking for updates.

It would be cool if nuget packages could issue bubble update notifications just like Nuget and other extensions for visual studio :)

Dec 28, 2012 at 4:51 PM

Package restore will always restore the exact versions that are missing. We don't want to automatically restore the latest versions because there's no guarantee that the latest versions will not introduce any breaking changes.