How to view relationships between classes as a visual diagram? - visual-studio

when joining an existing project it can become confusing trying to figure out how all the classes and interfaces are connected to each other. Instead of going to individual classes and following its relationships, is there a way to visually see all the connections in a diagram? Is there anything that can be done in IntelliJ(11 | 12) or Visual Studio(2010 | 2012 - preferably express or pro)?
For example, something like a UML diagram showing class A inherits from class B which extends a certain interface, etc.
Similar functionality is in Eclipse where you can view a graphical representation of a bean config file. Also in Visual Studio you can view the DB relationships

I am not sure what version of Visual studio you are using but in VS 2012 pro (Update 2) you can right click on a project and click the "View Class Diagram" option. This will Create a diagram of all classes in the project.
http://msdn.microsoft.com/en-us/library/6x35cds6.aspx
Looks like capability goes as far back and 2010 and even 2008.

this is old but it's magical in VS2019. right click on project solution or any classes
you want to see dependencies and hit "Show Type Dependency Diagram".

Related

Sharing custom HTML elements among team members

In the question: Create custom html control in toolbox Visual Studio 2012, the OP gets an answer about creating a custom HTML control in the toolbox of Visual Studio. I want to do the same thing and then share that with team members. We are all pulling projects from the same TFS Repository, so I would like to use that if possible. I hope to achieve something on the level of sharing newly added abbreviations to the team for Intellisense. I would prefer to not require an install or adding an extension, and especially not creating a DLL that must be referenced or added to the toolbox manually. Just something that adds these custom HTML controls to the toolbox, with maybe a "Get Latest".

How to generate class diagram from project in Visual Studio 2013?

In Visual Studio 2010 I can generate class diagram from my project with 2 clicks. But now in Visual Studio 2013 I don't see the option "View Class Diagram" in project menu. Where did this item disappear? How can I generate class diagram from project now?
Right click on the project in solution explorer or class view window --> "View" --> "View Class Diagram"
For creating real UML class diagrams:
In Visual Studio 2013 Ultimate you can do this without any external tools.
In the menu, click on Architecture, New Diagram
Select UML Class Diagram
This will ask you to create a new Modeling Project if you don't have one already.
You will have a empty UMLClassDiagram.classdiagram.
Again, go to Architecture, Windows, Architecture Explorer.
A window will pop up with your namespaces, Choose Class View.
Then a list of sub-namespaces will appear, if any. Choose one, select the classes and drag them to the empty UMLClassDiagram1.classdiagram window.
Reference: Create UML Class Diagrams from Code
For Visual Studio 2019 and Visual Studio 2017 Users
For People who are missing this old feature in VS2019 (or maybe VS2017) from the old versions of Visual Studio
This feature still available, but it is NOT available by default, you have to install it separately.
Open VS 2019 go to Tools -> Get Tools and Features
Select the Individual components tab and search for Class Designer
Select this Component and Install it, After finish installing this component (you may need to restart visual studio)
Right-click on the project and select Add -> Add New Item
Search for 'class' word and NOW you can see Class Diagram component
see this answer also to see an image associated
https://stackoverflow.com/a/66289543/4390133
(whish that the moderator realized this is the same question and instead of deleting my answer, he could mark one of the questions as duplicated to the other)
Update to create a class-diagram for the whole project
Here is how to generate a diagram for the whole project (after applying the previous steps)
Add class diagram to the project
if the option Preview Selected Items is enabled in the solution explorer, disabled it temporarily, you can re-enable it later
open the class diagram that you created in step 2 (by double-clicking on it)
drag-and-drop the project from the solution explorer to the class diagram

No export options for Modeling Project on Visual Studio 2012

We have created a new Modeling Project on Visual Studio 2012 to have all of the class and sequence diagrams, however there is no option to export the diagrams to images like the diagrams created via "View class diagram" option in a Class Library.
Why? How can I export the diagrams from this project template?
I've been trying to find a way to export the diagrams and now I realized that selecting the elements of the diagram, copying and pasting to another application (like MSPaint or Word) does work.
However, the header of the diagram (with the name of the class diagram) is ignored.

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 ?
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.
From inside Visual Studio go to Tools -> Get Tools and Features
Select the Individual components tab and search for Class Designer
Check this Component and Install it
After finish installing this component
Right-click on the project and select Add -> Add New Item
A. Search for 'class' word and NOW you can see Class Diagram component
Very Important Update From the Comments below
Right-clicking on a folder and selecting Add New Item will NOT show the Class Diagram option.
You could right-click on a project.
Not every project type will support Class Diagram For example,
Right-clicking on Class Library project will DO show Class Diagram option in the Add New Item dialog.
But Right-clicking on ASP.NET project will NOT show Class Diagram option in the Add New Item dialog.
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 class diagram for your project.
Ref:
https://msdn.microsoft.com/en-us/library/ff657806.aspx
How to generate class diagram from project in Visual Studio 2013?
Thanks

How to generate Class Diagram in Visual Studio 2008

Now , I am working with Visual Studio 2008. I want to Create Class Diagram. I don't want to design the class diagram. I mean I want to generate class diagram automatically by using VS 2008. Please help me.
Right click on the project, choose "View Class Diagram".

Resources