Sunday, November 28, 2010

Dependency Graph in Visual Studio 2010 – View Assembly Dependencies

DependencyGraphClassLayout2711.jpg

The Visual Studio 2010 Ultimate Edition has some excellent Architecture tools for modeling new applications, as well as analyze an existing application. One tool amongst them is the ‘Dependency Graph’.
As quoted in MSDN, Dependency graphs help you learn more about the organization and relationships in existing code. So let us say that you have just joined a new project and the application has no documentation (yes we have all been there!) or you need to move your project from an older version to a newer one and want to use a tool to make sure that there are no references during the upgradation or you simple want to explore an assembly inside out - the Dependency Graph can be very useful in all these scenarios.
In this article, we will start by seeing how to explore an existing .NET assembly using the Dependency Graph tool. In future articles, we will see how to generate dependency graphs for projects, like an ASP.NET project. We will be using the System.Web.Routing.dll for this example. You can find this assembly on your machine if you have .NET 3.5 SP1 or .NET 4.0 installed. Alternatively, you can choose any other assembly of your choice.

Let us get started:
Step 1: Open Visual Studio 2010 > Architecture > New Diagram
Step 2: Choose ‘Directed Graph Document’ from the list of Diagrams and click OK as shown below:
Note: If a Modeling project does not exist, you will be prompted to create one. Give it the name ‘WebRoutingModeling’ and click OK.

Read more: dotNetCurry