Sunday, February 24, 2008

A Visual Studio 2005 solution generator in Ruby

Sometimes when you develop a big product you don't have a big solution that involves all your projects, but instead you have many smaller solutions that are used as views for some particular aspect of the product. This has the benefits that brings separation of concerns at a product structure level and you also get less resource costs from Visual Studio.

But sometimes you need a monster solution (100 projects for example) as this would be useful when you need to make global refactorings, build scripts, metric analysis, etc.

Mantaining this sln file manually is not the best thing to do because for example you can easily miss new projects added or removed from a smaller sln in which some developer is working at a smaller scope. You can ask the developer to keep it up to date with each change but that's an RMBT (Risky Manual Boring Thing) which is a smell.

So I made this simple ruby script that creates an sln file containing all the projects found in the current directory tree.
It will recursively search for csproj files in your directory tree and create the corresponding project entries with the correct guids.

Note that:
  • You can optionally specify the sln file name.

  • The source control bindings must be mapped manually.

  • The native guid generator used is taken from here.