Using Solution Factory inside of NuPack opens up a great new world of creating Solution Level templates. Previously, I wrote a lot of code in Solution Factory that just kept running into edge cases working against the Visual Studio automation API ,DTE. Most of what I wanted to achieve was setting some defaults and installing dependencies. This is where using solution factory with Nupack really shines.
The following code is a prototype of what you could use to make a MetaPackage for NuPack . (A meta package is a package that would not contain any assemblies or content to add to a project but would rather chain together a set of packages). In this scenario, using Visual Studio I can create a MVC project and using this script I automate setting up a test project with the latest versions of the testing tools that I like to work in.
The commands that Solution Factory adds to the Package Management Console are:
After running this code, you will see the following output in the console
You can see the console pretty much echoes the commands of my little PowerShell script. Lets look at the solution explorer to see what was added.
The Test project was added and it follows the convention/ naming pattern that I like. You can see that the assembly references are pretty clean. This is pretty much the way I like it but with previous solutions like solution factory, I get the benefit of having the latest version of each of the libraries, thanks to NuPack.
While this is a little proof of concept, this can be turned into something much larger. At Headspring, I put together a standard File –> New –> Headspring project and it followed a more complex project structure that had some pretty specific ways of controlling dependencies so that Core logic did not depend on 3rd party assemblies. You can read more about this approach on Jeffrey’s Blog. The part that broke down for us, is that it took a lot of effort to automate the process of setting up our structure with the latest and greatest bits. I think building on what I demonstrated here will really go far, for projects like Sharp Architecture, FUBU MVC, and any other project that wants to setup an opinionated way of working.
I can see bundling up known solutions together in a way that just was not easy to create and share with the community, I really think that will change now. And I am very excited about what will come as NuPack and Solution Factory evolve over the next few months.
Solution Factory is in the current NuPack feed so you can start using this now. The code for Solution Factory is located on codeplex, but exists in one of my Forks, I will spend some time over the next few weeks moving this into the main trunk and I removing all of the existing Solution Factory Add-in and Command Line applications. The code is just not needed anymore.. And deleting code that has no value, makes me happy!
Comments? Let me know. If this is something you have a passion for, let me know and we can work together on building out more of solution factory!