I have been using VS 2015 and like the Class Diagram item.
I recently upgraded to 2017 and can't seem to find the Class Diagram item.
Anyone know how I get to it?
-
38Go to menu Tools-> Get Tools and Features. Pick 'Visual Studio extension development' workload, choose 'Class Designer' option. Install– Artur KarboneDec 29, 2017 at 16:30
-
1VS Docs - How to: Add class diagrams to projects– KyleMit ♦Oct 23, 2019 at 19:14
10 Answers
Using VS2017 Enterprise:
-
9You need to type "Diseñador de clases" if you run the spanish version Nov 8, 2017 at 19:24
-
3In the French version of Visual Studio Community 2017, type "Concepteur de classes" In the German version, type "Klassen Designer" (thanks to @dba)– LePatayMay 17, 2018 at 7:07
-
-
5
Noticed this in the beta and thought I had a bad install. The UI elements to add new Class Diagrams were missing and I was unable to open existing *.cd Class Diagram files in my solutions. Just upgraded to 2017 and found the problem remains. After some investigation it seems the Class Designer component is no longer installed by default.
Re-running the VS Installer and adding the Class Designer component restores both my ability to open and edit Class Diagrams as well as the UI elements needed to create new ones
-
2What UI elements are made available? This component is checked off for my install (VSPro 2017), but no menu option titled 'Class Designer' is available when I restart VS. --- Whoops, my bad. Since there's probably someone else out there as absent-minded as I am, here is a step-by-step guide from MS. I was trying File>New>File, but I needed to do Project>Add New Item. The curse of infinite menus... Aug 21, 2018 at 15:35
You need to install “Visual Studio extension development” workload and “Class Designer” optional component from the Visual Studio 2017 Installer to get the feature.
See: Visual Studio Community 2017 component directory
But this kind of item is not available on all project types. Just try for yourself:
In a Console App (.NET Framework) is available;
In a Console App (.NET Core) is not available.
I couldn't find more info on future availability also for .NET Core projects.
-
2
-
1
-
4
-
Actually it is available in .NET Core, but you need to go inside a class (controller, service, etc.) and Right-Click -> "Add to quick diagram" Aug 19, 2018 at 17:16
Woo-hoo! It works with some hack!
According to this comment you need to:
Manually edit
Microsoft.CSharp.DesignTime.targets
located inC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\VisualStudio\Managed
(for VS Community edition, modify path for other editions), appendClassDesigner
value toProjectCapability
(right pane):Restart VS.
- Manually create text file, say
MyClasses.cd
with following content:<?xml version="1.0" encoding="utf-8"?> <ClassDiagram MajorVersion="1" MinorVersion="1"> <Font Name="Segoe UI" Size="9" /> </ClassDiagram>
Bingo. Now you may open this file in VS. You will see error message "Object reference not set to an instance of object" once after VS starts, but diagram works.
Checked on VS 2017 Community Edition, v15.3.0 with .NETCore 2.0 app/project:
GitHub issue expected to fix in v15.5
-
2I didn't have to modify do step 1. Just creating an .cd file with xml content displayed here seems sufficient for making it work with dotnetcore. Thanks for this hack.– eka808Jun 5, 2018 at 17:31
-
1
the following procedure worked for me:
- Close VS.
- Run Visual Studio Installer.
- Click on the 'Modify' button under 'Visual Studio Professional 2017'
- In the new window, scroll down and select 'Visual Studio Extension Development' under 'Other Toolsets'.
- Then on the right, if not selected yet, click on 'Class Designer'
- Click on 'Modify' to confirm
-
4Btw. now it is doable from VS, so no need to close, just click Tools->Get Tools And Features Dec 29, 2017 at 16:25
-
1Yes, you are right @ArturKarbone, although the installer mostly closes VS on its own then. May 9, 2018 at 4:51
VS 2017 Professional edition- Go to Quick launch type "Class..." select Class designer and install it.
Once installed go to Add New Items search "Class Diagram" and you are ready to go.
In addition to @ericgol's answer: In the French version of Visual Studio Community 2017, type "Concepteur de classes" in the search bar.
-
3in German: "Klassen Designer" :) - funny thing, MS doesn't recognize it's own default language in localized search......– dbaFeb 8, 2018 at 10:13
-
This post does not seem to provide a quality answer to the question. May 17, 2018 at 5:50
-
1sɐunıɔןɐqɐp My answer was meant to be a simple addendum to ericgol's answer, but at the time, I could not comment everywhere due to my reputation's level.– LePatayMay 17, 2018 at 7:06
Open Visual Studio Installer from the Windows Start menu, or by selecting Tools > Get Tools and Features from the menu bar in Visual Studio.
Visual Studio Installer opens.
Select the Individual components tab, and then scroll down to the Code tools category.
Select Class Designer and then select Modify.
The Class Designer component starts installing.
For more details, visit this link: How to: Add class diagrams to projects
I am using VS 2017 Enterprise, you can find an option to install the class diagram extension using he Quick Launch in VS.
-
This was already answered here: stackoverflow.com/a/43227591/823321 May 17, 2018 at 5:49
A further note on Dmitry's 2017 answer. I opened up
C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\MSBuild\Microsoft\VisualStudio\Managed\
Microsoft.CSharp.DesignTime.targets
and went to the <ProjectCapability>
element. I already had this:
<ProjectCapability Include="
CSharp;
Managed;
ClassDesigner**;**" />
with ClassDesigner already there, and yet I was still unable to drag items to my hack-made Diagram.cd using the XML editing method Dmitry mentioned (
Manually create text file, say MyClasses.cd with following content:
<?xml version="1.0" encoding="utf-8"?> <ClassDiagram MajorVersion="1"
> MinorVersion="1">
> <Font Name="Segoe UI" Size="9" /> </ClassDiagram>
). But when I took off the semicolon off 'ClassDesigner' in that element then reopened Visual Studio, voila, I was able to drag classes from my Solution Explorer to my Diagram.cd window.
So in conclusion, this element in Microsoft.CSharp.DesignTime.targets
worked:
<ProjectCapability Include="
CSharp;
Managed;
ClassDesigner" />
I am using VS 2019, version 16.1.5.