Compartir a través de


How to: Add Class Diagrams to Projects (Class Designer)

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

To design, edit, and refactor classes and other types, add a class diagram to your Visual C# .NET, Visual Basic .NET, or C++ project. To visualize different parts of the code in a project, add multiple class diagrams to the project.

You can't create class diagrams from projects that share code across multiple apps. To create UML class diagrams, see Create UML modeling projects and diagrams.

To add a blank class diagram to a project

  1. In Solution Explorer, right-click the project name. Then choose Add New Item or Add, New Item.

  2. From the template list, choose the Class Diagram. For Visual C++ projects, look under Templates, and then under Utility to find this template.

    The class diagram opens in Class Designer and appears as a file that has a .cd extension in Solution Explorer in the project hierarchy. Use the Class Designer toolbox to drag shapes and lines to the diagram.

  3. To add multiple class diagrams, repeat the steps in this procedure.

To add a class diagram based on existing types

  1. In Solution Explorer, open the class file context menu, then choose View Class Diagram.

    -or-

    In Class View, open the namespace or type context menu, then choose View Class Diagram.

To display the contents of a complete project in a class diagram

  1. In Solution Explorer or Class View, right-click the project and choose View, then choose View Class Diagram.

    An auto-populated Class Diagram is created.

See Also

How to: Create Types by using Class Designer How to: View Existing Types (Class Designer) Designing Classes and Types (Class Designer) Viewing Types and Relationships (Class Designer) Working with Class Diagrams (Class Designer)