sebastian.roibu
sebastian.roibu

Reputation: 2879

Generate a class diagram from Visual Studio

I would like to generate a class diagram with relations for my visual studio project. I opened my solution, added a new ModelingProject, added a new .classdiagram file but when i want to drag my folders or my classes onto the diagram layout I get the "not available" sign.

Does anyone has any idea on how to fix this ?

Prove

Upvotes: 73

Views: 241529

Answers (2)

Hakan Fıstık
Hakan Fıstık

Reputation: 19511

For Visual Studio 2017, 2019 and 2022


This feature is still available, but it is NOT installed by default, you have to install it separately.

  1. From inside Visual Studio go to Tools -> Get Tools and Features
  2. Select the Individual components tab and search for Class Designer
  3. Check this Component and Install it

enter image description here

After finish installing this component

  1. Right-click on the project and select Add -> Add New Item A. Search for 'class' word and NOW you can see the Class Diagram component

enter image description here

Very Important Update From the Comments below

  1. Right-clicking on a folder and selecting Add New Item will NOT show the Class Diagram option.
    You should right-click on a project.
  2. Not every project type will support Class Diagram For example,
    Right-clicking on Class Library project WILL show the Class Diagram option in the Add New Item dialog.
    But Right-clicking on ASP.NET project WILL NOT show the Class Diagram option in the Add New Item dialog.

Upvotes: 165

Jeya Suriya Muthumari
Jeya Suriya Muthumari

Reputation: 2021

For generating the class diagram Visual Studio is providing the in-built option please use that, Go to class view window of your project, RightClick -> select View -> click on View Class Diagram. This will generate a class diagram for your project.

Ref:

Thanks

Upvotes: 58

Related Questions