Introducing Solution Maker 2.0: new features and support for Visual Studio 11
A couple of years ago I wrote a utility that could scan directories and generate solution files (I blogged about it here and here). I called it Solution Maker and later made its source available at BitBucket. I received feedback from users that helped me come with new features. And since developers are already using Visual Studio 11 preview, it was good time to add support for it. So this post is about new version of Solution Maker that can be downloaded from Visual Studio Gallery (and of course from BitBucket).
To show what can be achieved using Solution Maker, I’ve chosen a large project that builds assemblies familiar to every .NET developer: ASP.NET. Microsoft recently turned it into an open-source project and uploaded to CodePlex. Let’s point Solution Maker to its root folder and see what we can do.
When you start Solution Maker, it comes with a screen showing setting for a solution to be generated. We want to create a solution for ASP.NET Web Stack, so we will choose the name for a new solution (“AspNetWebStack”) and browse for a project root folder:
If we just want a flat project structure (and for small solutions this may sufficient), we don’t need to do anything else and can just click on “Create Solution” button. However, solutions tend to grow, and this where solution folders help splitting projects into logical groups. Solution Maker can automate this process by analyzing project and output assembly names. Let’s start however with a flat structure just to show what we will get in case we don’t want to create solution folders. Click on “Preview” button and Solution Maker will display a new window with a solution preview.
What we see here is 44 projects without any grouping. Not a very convenient structure. Let’s try to improve it a bit: set “Solution folder levels” option to 1, so Solution Maker will parse project names and create solution folders based on the leftmost word in a name of a project.
Looks better, doesn’t it? Note that ASP.NET Web Stack projects are named after the output of their respective assemblies, so you can leave a default naming strategy “Create solution folders based on project file names”. If this choice results in non-informative folder names (for example, if a project for assembly “System.Web.Http” was called just “Http”, then you wouldn’t have a chance to place it in a solution folder “System”), you may try an option “Create solution folders based on project output assembly names”. You can even choose the best of breeds: an option “Create solution folders based on most qualified names” is useful when projects don’t have single naming strategy. Then Solution Maker will analyze their names and assemblies and choose the one that gives the most informative name.
Now we have 44 projects divided into 4 solution folders, but folder “System” contains 27 projects which may be still too many. Let’s increase the number of solution folder levels. Here is what we will get:
What if you only want a subset of projects? This can be achieved using filters. For example, if we want a solution without test projects, we can specify a filter string “*.Test;*.Test.*” in “Project exclude filter” edit box. This will instruct Solution Maker to exclude 25 test projects:
So far so good. But until we assumed that the project root contains all project dependencies, and this is not necessarily the case. It can be easily demonstrated by moving the project root folder to one of subdirectories, for example, to “Src\Microsoft.Web.Mvc”. Imagine that we want to create a solution only for MVC stuff. If we now generate a solution file, it will contain just one project:
This is rather silly. Obviously, Microsoft.Web.Mvc has some dependencies, and we want them in the solution. This is the time to enable “Include referenced projects” option:
Finally, if you prefer command line or need to integrate solution generation into a build workflow, all Solution Maker options can be specified at the command line:
Solution Maker is a free open-source projects, so it’s easy to extend it or adjust for your specific needs.