Visual Studio 2010 UML Extensions for Class Diagrams

I’ve always used Enterprise Architect for creating UML diagrams because it’s packed with tons of usability features that make it easy to create various diagrams.  My  company decided to use Visual Studio 2010 for all UML going forward.  Visual Studio is an unbelievable development tool that is at the top of the list for software that developers like to code with.

Unfortunately, creating UML diagrams in VS has a lot to be desired.  To create modeling projects in visual studio, you first must download the Visualization and Modeling Feature Pack.  Once this is done, you can create a new modeling project that supports the following diagrams.

After spending a few days creating class diagrams, I felt frustrated with how much effort it takes creating elements in each of the diagrams.  I’m used to having right-click options that allow me to create new elements that are attached to them element I’ve clicked on.  The only way I could do this was either drag the object to the diagram or right-click and add.  Once the object was placed where I wanted it, I have to use the mouse to click on the association I want in the tool bar then click on the two objects that I want to associate together.

Luckily Microsoft has built an extension framework for Visual Studio which allows you to add commands, tools, templates, etc. to the environment.  After downloading the Visual Studio Visualization and Modeling SDK, you can create new projects for creating commands, gestures, or validation extensions for modeling projects.

I used the Command Extension project to create a new project that has a bunch of new right-click commands and double-click commands for the class diagram.  Here’s a chart showing the  new double-click shortcuts that I’ve created:

The menu options shown in the red circle below are installed with the extension and will show when you click on the appropriate elements in the class diagram.  These options allow for quick class creation with association links.  The menu options will be disabled if you have not clicked on the required number of elements.

The disabled options for creating associations are not enabled in the screenshot since I’ve only clicked on one element.  If two elements are selected, then the Create Class… options will be disabled and the Create Association… options will be enabled.  Here’s a reference chart that describes what each Create Class option should be used for.

Go to the Microsoft Visual Studio Gallery to find the extension or just go to the Extension Manager under the Tools menu in Visual Studio.   The extension is called “Brian’s UML Extensions”.  After you’ve install the extension, you will need to restart.  This extension is only available for VS Ultimate.  Eventually, I’d like to add extensions for the other UML diagrams, but for now, this is all that I had time for.


If you’re interesting in creating your own Visual Studio UML Extensions, then check out this page on the MSDN website.