I’ve been wondering about the best strategy with using NuGet packages and source control. For example, I don’t like to have to get the source for a project then spend ages installing all the different pre-requisites from NuGet if I can help it. Also checking in all the binaries from the packages seems a waste of space plus the problems if ever merge issues come up and the general nastiness of binaries in source control. So what to do…
Well VS2012 has a very neat feature, the Enable NuGet Package Restore option on the context menu of the solution (in solution explorer). If you select this option and you mark the NuGet packages folder as being ignored from your source control system. Then VS2012 will automatically grab the correct versions of the packages for you, but you’ll also need to go into Tools | Options | Package Manager and tick the All NuGet to download missing packages during build and then when you build the project the missing packages will be downloaded as part of the pre-build step (note: this step will not need to be repeated on a per solution basis, unlike the Enable NuGet Package Restore step).
See Using NuGet without committing Packages for a far better explanation.