Adding a Nuget package and automatically downloading missing dependencies
Probably not as quick of the mark as others have been with Nuget, but I am now starting realise the real benefits it brings to .net Development. I’ve been using it for a while but wanted to avoid putting all the third party code being in source control.
Luckily Nuget comes in the form of a command line tool and by including that in your solution, typically I have a “BuildTools” solution folder where I keep a whole host of wonderful scripts and fun! Then if you add the following pre-build event:
"$(SolutionDir)BuildTools\Nuget\nuget" install "$(ProjectDir)packages.config" -o "$(SolutionDir)Packages"
This basically runs the nuget exe and processes through you packages.config file and outputs to the packages folder.
Thus if you are missing assemblies on your local box or a build server it will pull them down. As long as the nuget.exe and the packages.config (from each project) is in source control. Then problem solved.
Quick summary on Nuget (addition).
Nuget is a package management visual studio extension and command line tool for .NET development. Please visit their homepage for more information.
First of all to install Nuget you need to open up visual studio and select the Tools menu and click on “Extension Manager”.
Check to make sure you have not already installed Nuget! Who knows someone may have been kind! Okay assuming its not there then you need to select on highest rank extensions select “Nuget Package Manager” and click the “Download” button.
Hopefully through a few prompts the package manager will be installed and you should be able to see a new Package Manager Console window.
You should also be able to select “Manage Nuget Package” when you click on solution explorer window with the right button – context menu. If you click this you now get the following popup dialog.
So you can check for updates here or click “Online” to search the nuget gallery etc. Click install with install that package in the local “Packages” directory and update all the references, and quite possibly run some other custom scripts.