Nuget package restore is a way to tell MSBuild to download any missing packages as a pre-build step.

This means that you can exclude your packages from source control, making your repositories smaller, faster to work with, and cheaper to back up (as you have just removed a bunch of binary data that is painful to merge and doesn’t change very often).

Enable NuGet Package Restore

Microsoft provides a variety of options for how to configure automatic package restore:

Look through those choices and pick the option which is right for you.

Personally, I use the Command-line restore approach as it is easily scripted with no dependency on Visual Studio or TFS.

But what about…

This is awesome, but brings with it a risk: what happens if your dependencies are not available when you go to build them?

Imagine that a new dev joins your team, gets latest on your source tree, and one of your package dependencies is not available in the public feed? How do they build the project?


Perhaps the package is available, but not the version specified in your projects' packages.config files? You don't want your team randomly getting the latest and greatest version of a dependent package any time they want, because we want to manage the risk that our code might break by using different versions of our dependencies.

To manage these risks I recommend that you set up your own internal package feed.

More on that next time.