Favorite VS2010 Features: Dependency Graphs and DGML

As we get closer to the launch of VS2010 I’m covering some of my favorite new feature areas for VS2010.  For this post I’m going to talk about Dependency Graphs and it’s underlying support, DGML.

Generating Graphs

At some point I’m sure you’ve joined a team (or inherited a code base) which you did not create.  I’m guessing there is a good chance you didn’t wind up getting a fantastic set of documentation or architecture for some of those projects.  Wouldn’t you love to start by understanding what you’ve just gotten yourself into?  This is where Dependency Graphs come in.

Generating a dependency graph with VS2010 Ultimate is easy using the Architecture, Generate Dependency Graph menu:


In this case we’ll look at the diagram by namespace using the Tailspin sample application.  VS will walk through the binaries of the program looking for all of the dependencies and generate a DGML file with the data.  The top level view will start off with the namespace dependencies at the highest level (assembly boundary):


From  here you can navigate dependencies and drill down to more detailed information.  Simply hovering over an item will give detailed information about that item.  Hovering over a link will also provide additional information about the type of link (such as a method call or reference).  Clicking the expand button will update the graph to show the next level of detail:


You can continue to explore links and items to an increasing level of granularity.  In this example the classes in a namespace are shown:


You can continue to drill down all the way to the source code itself.

Architectural Explorer

Now that we have our visual view of the system, we can also use the Architectural Explorer to spelunk through our application.  Activating the explorer is easy:


The explorer window allows you to drill down on the contents by clicking as well as with filtering.  In this case we’ll find any class with ‘Model’ in the name and further drill down to the definitions in the class:


This support is customizable and allows you to author queries you can re-run later.


Dependency Graphs are stored in XML using the DGML DOM.  Using DGML is very easy (Cameron has a getting started post here).  If you open the example above, you’ll find all the raw data for the Tailspin application:


This makes the system incredibly powerful because the DGML viewer in Visual Studio can be used to view any DGML document, including content you produce from your own tools.  As an example, VS ships with a built-in help file that explains how to use the mouse to interact with the DGML viewer.  That file itself is a DGML file:


There are many easy extensibility points with the system.  As an example we’ve had 3rd parties augment the dependency graph information to include more data such as runtime profiling coverage. 


This is just a few examples of the new ways to explore your existing software.  In addition to helping you understand the system, we want to provide tools that allow you to evolve the architecture (or fix as necessary).  That support includes being able to describe the logical tiers of your application and enforcement of layering with new changes.

To learn more, check out these great links:

Comments (12)

  1. Raghuraman says:

    Thanks for the write up.

    Interestingly very similar to the NDepend Tool.

    Is this something which will be delivered OOB within VS 2010 ?

  2. Randolpho says:


    Looks like it comes with VS Ultimate only, a (by current MSDN prices) 6,000 to 10,000 dollar purchase.

  3. Robert says:

    Nice, but since it is basically unaffordable to the majority of developers, it becomes a meaningless feature.

  4. solfried says:

    The DGML viewer is a great tool. I can think of many applications outside of Application Architecture where it would be useful.

    I agree with the other posters that the full potential of this technology will not be realized if the price point is the cost of VS Ultimate.

    I would hope that the viewer would be made available as a GUI Control (which I assume is how VS Ultimate uses it). Then developers could purchase a dev license to include the viewer in our own apps (the control should come free with Ultimate).

    Does anybody know if providing the viewer as a control is planned?

  5. Nunya says:

    Very nice.  But why must you taunt us this way?

    As indicated, this would have value to anybody that’s inherited code for maintenance i.e, NOT architects). But as others have stated, limited to Ultimate edition guarantees most will never even see this feature.

    When presenting new features limited in edition (especially to Ultimate/Team Systems), please (all MS folks) state that limitation up front.

  6. Phil says:

    To be fair Nunya, the article does state VS 2010 Ultimate although it is a kind of throwaway statement.  I, and I’m sure many other developers, are in the fortunate position of being supported by a large comapny with sufficient budget to provide us with VS 2010 Ultimate and we are certainly going to get some benefit from this tool.  At the end of the day, if there are going to be variants of the IDE aimed at differently budgeted groups of developers some folks are going to have to expect to miss out on some of the goodies.

  7. Police01040 says:

    they change the name of software then resell

  8. Frederic says:

    Is this gone a work with native C++ ?

  9. @Frederic

    We recognize the need to make this work for native C++ however with RTM, you won’t see these features. Stay tuned though!

    Boris Jabes

    Visual C++ Team

  10. Jeremy says:

    This looks wonderful. Will it be possible to use Visual Studio’s DGML viewer in our own applications, much like how the Workflow designer is reusable?

  11. srikalyan says:

    I think feature would rock like anything. Seriously programming using some open source libraries is always been pain as there is not sufficient documentation. But, this feature would help in having a quick overview of the entire library.

    eagerly waiting to get my hands on RC.


  12. Jason Zander says:

    I got a question in email on how to get the help.dgml in the product.  My response in email bounced off the server so I’m posting the answer here:

    1.  Right click, Add > New item

    2.  Pick "Directed Graph Document", add

    3.  On the empty page you will find "For help about browsing the graph with the mouse, click here"

    At that point just click the ‘here’ hotlink and it will pop up.

Skip to main content