Showing posts with label NuGet. Show all posts
Showing posts with label NuGet. Show all posts

Wednesday, August 17, 2011

Using NuGet to download all packages for the solution

Here I'm talking about technique which allows you to use NuGet without committing packages to source control (which is handy in case you use Mercurial). First time I've heard about this approach from José F. Romaniello post. In essence: each project within solution has a pre-build step ensuring that all packages are downloaded via NuGet.exe command line utility. While this approach works well for a small project, it has some drawbacks with large solutions:
  • It forces me to insert that build step into each project within solution, which is a little bit annoying.
  • It increases solution build time. This becomes visible for a solution containing a lot of projects. I guess that was one of the main reasons why Simon Cropp wrote this post.
So, do I really need to check for NuGet packages on each build? It think that checking for dependencies at CI server, and perhaps after pulling changes from source control might be enough.

To achieve this I use a Powershell script which looks for packages.config files within a solution and executes NuGet.exe for each of them.


This script uses repositories.config file to locate packages.config files instead of searching them in file system. Obviously to make it work, repositories.config should be placed in source control and path variables should be adjusted according to the solution folders structure.

Hope you find this post helpful. At least I've learned some new things about powershell :). Please share your thoughts.