Microsoft Blueprint Walkthrough – Creating My First Blueprint
One of my colleague, Archana Sachin Ghag who is a key member of our software factory team has just finished writing a Blueprints Walkthrough. I am sharing this walkthrough with rest of the development community hoping it may act as a jumpstart for your Blueprints adoption.
Before you start creating your own Blueprint using Microsoft’s Blueprint Manger go through this article which introduces Blueprint Concept and Blueprint Manager. To start building your own Blueprint, Blueprint Manager comes with “Microsoft Blueprint Factory” which is nothing but a Blueprint itself.
When you select “Microsoft Blueprint Factory” from Blueprint Manager and click “Unfold”, it prompts for project you want to unfold this Blueprint Factory. I usually prefer Blank Solution to unfold Blueprint Factory.
Before unfolding starts, user will be prompted for the project name.
By default, the name is shown as BlueprintFactory. You can change the name according to your requirements. I will say it as MyFirstBlueprint.
Unfolded project in blank solution will look like this.
When you right click MyFirstBlueprint project you get a context menu with caption “Blueprints” containing different options to configure various aspects of the blueprint.
Note: Menu item Blueprints is the key for Blueprint development. All guidance is provided through this menu. Whenever a blueprint is unfolded on a machine, it adds a blueprint context menu item specific to this unfolded blueprint which provides guidance to the developer.
Next step is to configure my Blueprint. Click Blueprints -> Edit Configuration. Blueprint will display Blueprint Editor which allows user to configure all possible options available with blueprint viz.
1. General Configuration
5. Related Blueprints
6. Installation Actions.
In this article we will see some of the general configuration settings and further discuss how to implement commands and menus in our custom blueprints.
Edit Configuration will show the following dialogue box.
On Configuration Tab you can configure
1. Project Name- This name will be used during unfolding of projects and it is also important as far as build artifacts of blueprint is concerned. When we build Blueprint project it creates a zip file containing all information for RSS. The name of this file will be <ProjectName>-RSS.zip. Build will also generate folder named ‘ProjectName_Pacakge’. This contains all files needed to run blueprint. To see all this information you have to open Windows Explorer after build and see your blueprint directory. You cannot see this information in Visual Studio itself.
2. Type of Blueprint can be Microsoft or Third Party or hidden.
3. Publisher will be your company name.
4. You can also give RSS feed link here. This is very important from a delivery and deployment perspective as Blueprints Manager can update existing blueprints through this RSS Feed whenever a new version is available from within Visual Studio IDE itself.
We will now see how to use Commands and Menus Tabs to create our own Menu option for “Blueprints”.Each menu item has command associated with it. On click of this menu item, command associated with it gets executed.
Blueprint shows/executes its commands or menus from .Net library called Blueprint Extension Library. This library has to follow some standard so that blueprint understands it properly.
1. Assembly name for extension library should start with Blueprint’s project name.
2. Class which handles commands must derive from ‘BPMExtensionBase’ from ‘Microsoft.SoftwareFactories.Blueprints’
3. You must copy the extension library to “extensions” folder inside “MyFirstBlueprint” project folder.
Click Blueprints -> Add Extensions to create a new extension.
It will add extension library project to the solution and set Assembly Name as required by the blueprint. Specify project name for extension using the following dialog box.
Now solution will look like this
MyExtensions project contains class “ExtensionClass” with a sample command implemented that will help you to implement your own commands. You get Menu “Blueprints” even on MyExtensions project which will give option to see workflow which will give step by step guidance on how to use this project for your blueprint. Modify class ExtensionClass to implement your own commands. Build MyExtensions project using Visual Studio.
Now the next step is to specify commands from MyExtension which will be used by “MyFirstBlueprint”. For this we will again click on Blueprints -> Edit Configuration menu to get Blueprint Editor. Open Commands Tab.
Add new command and fill the details as follows
Once command is added, the only step remains is to associate this command with a Menu Item. Create new Menu Item using Blueprint Editor’s Menus Tab.
Visibility has many options supported as Filters. You can see all available Filters from Blueprints -> Workflow menu item. These filters decide for which project or project item you want to show this context menu item.
Save both projects and build them. Once built and auto install is successful, you can see your blueprint entry in Blueprint manager. Unfold it and see whether you get custom menu created by you.
NOTE. Remember you have checkbox “Custom Menu Filters” checked on Blueprint Manager to see your own menus.
Hope this helps to quick start Blueprint development. Once Menus are appearing you can write whole lot of customized stuff in your commands to auto generate repetitive code or provide any kind of guidance needed.