Adding your own Layer Diagram Patterns to the Toolbox
I like the Layer Diagrams in Visual Studio 2010 Ultimate and the idea of creating my own patterns to choose from in the Toolbox is very appealing, so I thought I’d look into it. It turned out to be very easy and although this is documented I thought it was worth a quick summary.
First, you need to create the template layer diagram – i.e. create the end result that you’d like to see after the toolbox item is used. This is just a normal layer diagram in a normal modelling project. For this example I decided to create a simple pattern to reflect layers in a application where the UI is in the cloud and the data is kept on-premise:
Having completed your diagram you can now add this to your toolbox as follows:
1. Open the folder where the layer diagram project is located (if in doubt right-click on the solution in the Solution Explorer window and select Open Folder in Windows Explorer).
2. Copy the .layerdiagram, .layerdiagram.layout and .layerdiagram.suppressions files.
3. Paste these three files into the following folder: “C:\Users\<Your User Name>\Documents\Visual Studio 2010\Architecture Tools\Custom Toolbox Items”. You will need to create the folders if they don’t exist already (I needed to create Architecture Tools\Custom Toolbox Items).
4. Add a new XML file to the same folder, of any name but with the extension .tbxinfo.
5. Add the following content and edit the descriptions to suit:
1: <?xml version="1.0" encoding="utf-8" ?>
2: <customToolboxItems xmlns="https://schemas.microsoft.com/visualstudio/2010/TeamArchitect/CustomToolboxItems">
3: <customToolboxItem fileName="DataOnPremise.layerdiagram">
4: <displayName>
5: <value>Azure Data On Premise Layer Pattern</value>
6: </displayName>
7: <tabName>
8: <value>Giles Custom Layer Patterns</value>
9: </tabName>
10: <image>
11: <bmp fileName="cloudservice.ico"/>
12: </image>
13: <f1Keyword>
14: <value>PlayerHelp</value>
15: </f1Keyword>
16: <tooltip>
17: <value>An example layer diagram pattern</value>
18: </tooltip>
19: </customToolboxItem>
20: </customToolboxItems>
6. Either right-click on the toolbox and select Reset Toolbox or restart Visual Studio and you should now have a new toolbox item:
Pretty straightforward, and all I‘d want to do to distribute this properly is package it in a VSIX file.
Cheers,
Giles