In a post a week or so ago, I introduced the notion of Feature Packs.  Now I get to tell you about the availability of the first one!  I intended to post the same day but I sat down to play with the feature pack to make sure I understood what all it could do and I realized that my impressions didn’t quite match reality.  I wanted to spend some time with the team making sure I understood how I should be thinking about these abilities.  Then between Tech Ed presentations, travel, etc – it’s now a week later :(

Last week we released the first Feature Pack called the Visual Studio Modeling Feature Pack.  It is an add on to Visual Studio Ultimate for people with MSDN subscriptions.  Over time, we’ll add more.  We’re working on one for people using the new Visual Studio Test features and one for users of TFS.  My hope is that we’ll ship about 3 a year.  We’ll see how that unfolds.  If you are not a VS Ultimate user and are kind of feeling bummed about not getting anything from this cool new feature pack, check out the Pro Power Tools here: http://blogs.msdn.com/b/bharry/archive/2010/06/07/announcing-the-first-visual-studio-pro-power-tools.aspx and take heart that more is on the way.

There are a bunch of cool new things in the Modeling Feature Pack.

C++ Support

As you may know, in VS 2010, there’s no support for C++ in our modeling tools.  This feature pack includes the first installment of C++ support.  It’s not complete but it’s a beginning. 

The first part worth talking about is support is dependency graphs (Architecture –> Generate Dependency Graph –> By *).  This enables you to create visualizations like the one shown here to easily see the dependencies between classes in your C++ code.  Be aware that this only works for dependencies that cross DLL boundaries.  It won’t show dependencies within a DLL – a limitation we plan to remove but still useful even with it.

Click for larger image

A cool new feature that’s not just a C++ extension of an existing feature is header file dependencies!  How many times have you found yourself crawling header files trying to figure out where something got included?  This new header file dependency feature makes it really easy.

image

Web Site Support

We’ve added support for the architectural tools to really understand the structure of web sites and the artifacts contained in them.  It now understands ASP.NET MVC, various web resources, etc. making it way easier to get a high level view of the structure and dependencies in your web app.

image

Click for larger image

 

UML Class Diagram Code Generation

In VS 2010, we did not include any capability to generate code from diagrams.  With the feature pack, we can now generate code from class diagrams.  Imagine that I had designed some classes like this:

image

I’ve now reviewed the design with everyone and I’m ready to start writing code.  What do I do?  Well in VS 2010, you Project –> Add –> Class and start typing.  With this new feature pack, we make it a little easier.  You can right click on the diagram and choose Generate Code.  You’ll get nice auto-generated code like this:

image

It’s a nice typing saver.  The big limitation that I want to point out here is that although we already support generating a UML diagram from code and now we support generating code from a diagram, we don’t yet support round tripping.  The code you generate from a diagram will always look like this template.  There’s no way to get it to update a class that you generated the diagram from in the first place.  Think of this just as a typing saver when you are doing logical design of classes and then you are ready to start coding.

Maybe you don’t like the format of the code it spits out or you want to add some more to it.  Check out the T4 templates in

%LOCALAPPDATA%Microsoft\VisualStudio\10.0\Extensions\Microsoft\Visualization and Modeling Feature Pack\1.0\Templates\Text

Those templates control the code that is generated.  You can tweak them to get what you want (though please be careful to save the originals in case you decide you don’t like what you create :)).

A few more comments on limitations.  For now, you can only generate C# class code.   I think you could create T4 templates for VB and/or C++ but I haven’t tried it.

Layer Diagram Validation Extensibility

One of my favorite features in VS 2010 is layer diagrams and the ability to enforce that my code corresponds to my layer architecture as part of the build.  We’ve been getting feedback that people would like to extend the layer diagram with new commands, gestures (double click, drag/drop) and enforce additional rules as part of this process.  This Feature Pack introduces extensibility that allows you to do just that.  You can create new extensibility projects with these project templates.  Note, you will need to install the VS SDK to do so.  You can go to Tools –> Extension Manager and search for Visual Studio SDK to find it.

image

When you go to get the Feature Pack, you will notice that there is also a “Visualization and Modeling Feature Pack Runtime”.  This component is needed for someone to run the extensions you build.  The reason they are packaged separately is that using the modeling Feature Pack requires and MSDN subscription whereas using the extensions you build with it does not.

Links from Work Items to Models

In VS 2010, we added the ability to create links from models to work items, however, we didn’t have a way to link from work items back to model elements.  This feature pack adds the ability.  You can read details on how to enable it here: http://msdn.microsoft.com/en-us/library/ff657802.aspx

Once you install, you can link to a model element just like any other work item link type

image

It’s important to understand how this works.  To create a link, you need to have the solution containing the model open in the in IDE.  The linking process will create a uri to the model element.  You’ll want to make sure that the project is checked into TFS because when someone goes to open the model element through the link, it will only work if the solution containing the model is mapped into a workspace on the machine that the user opening it is using.

XMI Import

This release enables XMI 2.1 import which makes it easier to bring UML compliant documents into Visual Studio.  For now you will only be able to important documents targeting the subset we support.  You should expect us to add more document types in future releases of the product.

This is our first feature pack and there’s some very cool stuff in here.  As I said at the top, our plan is to do a few a year and I expect we’ll get even better at them as time progresses.

Please let me know what you think.

Brian