In my previous post i had outlined my first attempt at creating solution templates using the Visual Studio vstemplates technique. I have now gone one step further and built an add-in that allows the user to apply solution wide settings to all the projects. The settings that can be specified are as follows
- RootNamespace : Namespace prefix upto and not including the solution. This usually follows the format Company.Product. ProductGroup. (e.g) Microsoft.IntegrationPlatform.Services.
- Solution Name: Taken from the active solution, but can be changed to anything needed - for example CustomerService. The reason this is provided is because some teams like to keep the entire namespace in the solution name but while generating assemblies, the prefixes could be superfluous
- SolutionNamespace: Namespace comprising the rootnamespace and the solution. (e.g) Microsoft.IntegrationPlatform.Services.CustomerService where CustomerService is the functionality provided by the components of the solution.
- Application Name: This is the Biztalk application name to be applied to the biztalk projects. Sometimes this is the same as the solution name but need not necessarily be so.
- Key File: This allows the user to select an existing key file or to create a key file and have it applied to all the projects including the non biztalk projects (which is needed to allow them to be GACed).
Acknowledgements
The strong naming functionality is borrowed from the work done by Jon Flanders and Carlos Medina . In Jons tool you can generate and apply a strong name to a biztalk project on the fly and with Carlos' enhancements,you can generate and apply the strong name to all projects, or if you already have a strong named project you can copy those settings across to other projects. You can also apply the ApplicationName to the active configuration.
In this tool, the extra functionality is that you can
(1) apply the application Name to ALL configurations - deployment/development/debug/release etc (i usually add in the debug and release configurations to my biztalk projects to make it easy for my automated build scripts to move between biztalk and non-biztalk projects and
(2) choose a strong name file from anywhere on the machine and opt to use a hardcoded path to the key file or a relative path. At this time the relative path can only be calculated from the solution root so the program copies the snk file to the solution root and calculates it from there. Technically it is possible to calculate relative paths to anywhere in the source tree, but right now the code does not support this.
You can download the add-in from here.
As always, your feedback will be appreciated and welcome to help make this tool better. I am looking at trying out some wizards next which will be more flexible and allow more settings and options to be specified.
I've always been fascinated with the concepts and technique of automating VS development through macros, add-ins, templates etc.By now at my clients site we have more or less standardised what our Biztalk "services" look like but since we are still in Biztalk 2004 I didnt want to waste time with VS2003 automation as things have become so much more polished and advanced in later versions. I recently spent a couple of days at another client site with v2006 setting up the solution tree and MSBuild scripts and then sat back and wondered why i didnt have a tool to set the whole thing up in 5 minutes. It would have saved so much time that could have been spent on more significant issues. So today, after much procrastination (and collecting links on the subject), I finally decided to take the plunge and create my own multi-project template.
There's a wealth of material on creating Visual Studio Item and Project Templates and one of the best I've read is How to create starter kits (including multi-project templates). I gleefully put in the .net class library and test projects, schemas, maps etc and ran the Export Template Wizard. Imagine my horror when i found that it would not pick up Biztalk projects!!. So i got stuck for a while. I did have a look at Jon Flanders awesome videos on his Pattern Wizards including the facility to create biztalk project wizards from your own projects. I say, that guy is really something!! Anyway, that helps to some extent in that we can now "export" existing biztalk projects and use them later (and make them highly dynamic through wizards etc), but it still doesnt help create a multi-project template.
So I went ahead and decided to try and experiment. With the starter-kits article in hand I created the basic .NET projects and then decided to take a set of biztalk projects and add them in. I removed all the unncessary items, except for the btproj file. I then added in a .vstemplate file and a icon file (from the exported .net projects). I then edited the vstemplate file to set the links to the btproj files and so on. Ultimately having put them all together and zipped it up and dropped it into the Templates folder, voila, it worked. I have a multi-project solution with Biztalk projects in it.
In the btproj files i can set macros such as $safeprojectname$.Unfortunately no matter what I try it will not accept items such as schema files, maps etc. VS always complains that it cannot find the files even if they are included in the package. So i gave up that route and left the projects empty. I would like to try to set the Application Name as the name of the Solution in all the btproj files, but there doesnt seem to be a template parameter to do that
You can find the results of my handiwork at my new codeplex project site here . Feel free to play with it and let me know your thoughts and suggestions.
I'm thinking of extending this with add-ins and macros to create msbuild scripts to build and deploy the solutions. This would give projects a good kick start. Of course, people modularise Biztalk in many ways, some have multiple schema projects, some have multiple orchestration projects and the layout is not always the same. And of course, once you start using Jons tool, then the solution will morph into something very different from what the starter kit looked. So the Build and Deploy script generator tools must be capable of running at anytime and regenerating stuff from scratch. The codeplex site should see some growth very soon. It would also be interesting to hear how others lay out their projects especially how branching is done.
I've also written up another little tool to generate my source tree, taking inspiration from tools like TreeSurgeon. I should put that up soon. For now , i guess these tools will work together, but in a slightly disjointed fashion and in time i'll get a deeper understanding of VS automation and with stuff like GAT, theres a lot that can be done.
The big limitation right now is that doesnt link in with Jons work in any way. All my project templates that i made are sitting in the Biztalk Project Wizards folder, but the vstemplate only shows its own collection of btproj files which arent dynamic in any way. If anyone has some experience on linking VStemplates with wizards and would like to sharet the info please let me know. I'd love to be able to link my templates to Jons wizards, thus making it a highly dynamic and rich experience in creating multiproject solutions.