locked
C# Class Hierarchy Generator RRS feed

  • Question

  • I need to generate a class hiearchy of a Visual C# solution that contains 5 projects. Are there any tools that will help me generate this? Thanks in advance.
    Friday, August 13, 2010 7:58 PM

Answers

  • There are two tools that you can try:

    A) Dependency graphs

    You can these graphs to visualize code elements and their relationships as nodes and links. For example, to see calls between all the classes in your C# solution:

    1. On the Architecture menu, point to Generate Dependency Graph, and then click By Class. To start at a higher level, click By Assembly or By Namespace.
    2. To see the dependencies as a tree structure from top to bottom, on the dependency graph toolbar, click Top to Bottom. If the graph toolbar is not visible, on the View menu, point to Toolbars, and then click Directed Graph.

    To browse the code for specific elements and other kinds of relationships, use Architecture Explorer to select the elements and relationships that you want. You can then generate a dependency graph from the selected items. 

    • On the Architecture menu, point to Windows, and then click Architecture Explorer.

    These topics provide more information to help get you started:

    B) Install the Visualization and Modeling Feature Pack and then build a UML class diagram from existing code. 

    1. Add a modeling project to your solution, and then add a new UML class diagram.
    2. Drag from Architecture Explorer and/or dependency graphs.

    For more information, see How to: Create UML Class Diagrams from Code.

    Please let us know how these work for you. Thanks!

     


    Esther Fan | Visual Studio, Content Lead | If a post answers your question, please click "Mark As Answer" on that post. Thanks!
    Wednesday, August 18, 2010 5:53 PM

All replies

  • Hi William,

    Can you provide more details about what you're looking for? What do you mean when you say you need to generate a "class hierarchy"? Do you mean you want to reverse-engineer a class diagram from your solution?


    Esther Fan | Visual Studio, Content Lead | If a post answers your question, please click "Mark As Answer" on that post. Thanks!
    Tuesday, August 17, 2010 12:39 AM
  • I have C# code that is contained in 5 projects. Each project has multiple C# files. Each C# file may have one or more classes. There are references made between the classes. I would like to generate a diagram of the interdependency of the classes.
    Tuesday, August 17, 2010 2:22 PM
  • There are two tools that you can try:

    A) Dependency graphs

    You can these graphs to visualize code elements and their relationships as nodes and links. For example, to see calls between all the classes in your C# solution:

    1. On the Architecture menu, point to Generate Dependency Graph, and then click By Class. To start at a higher level, click By Assembly or By Namespace.
    2. To see the dependencies as a tree structure from top to bottom, on the dependency graph toolbar, click Top to Bottom. If the graph toolbar is not visible, on the View menu, point to Toolbars, and then click Directed Graph.

    To browse the code for specific elements and other kinds of relationships, use Architecture Explorer to select the elements and relationships that you want. You can then generate a dependency graph from the selected items. 

    • On the Architecture menu, point to Windows, and then click Architecture Explorer.

    These topics provide more information to help get you started:

    B) Install the Visualization and Modeling Feature Pack and then build a UML class diagram from existing code. 

    1. Add a modeling project to your solution, and then add a new UML class diagram.
    2. Drag from Architecture Explorer and/or dependency graphs.

    For more information, see How to: Create UML Class Diagrams from Code.

    Please let us know how these work for you. Thanks!

     


    Esther Fan | Visual Studio, Content Lead | If a post answers your question, please click "Mark As Answer" on that post. Thanks!
    Wednesday, August 18, 2010 5:53 PM