190

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?

2

10 Answers 10

217

Using VS2017 Enterprise:

  1. Go to the Quick Launch Bar (top right) Ctrl + Q
  2. Type "Class Designer" and an install link will pop up

    Quick Launch > Class Designer

  3. Click install, restart, and your off to the races... Enjoy!

4
  • 9
    You need to type "Diseñador de clases" if you run the spanish version Nov 8, 2017 at 19:24
  • 3
    In the French version of Visual Studio Community 2017, type "Concepteur de classes" In the German version, type "Klassen Designer" (thanks to @dba)
    – LePatay
    May 17, 2018 at 7:07
  • Works in Professional as well Sep 28, 2018 at 7:30
  • 5
    No results for me. Dec 19, 2018 at 20:46
150

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

VS Installer > Individual Components > Class Designer

1
  • 2
    What 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
34

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.

4
27

Woo-hoo! It works with some hack!

According to this comment you need to:

  1. Manually edit Microsoft.CSharp.DesignTime.targets located in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\VisualStudio\Managed (for VS Community edition, modify path for other editions), append ClassDesigner value to ProjectCapability (right pane):File diff

  2. Restart VS.

  3. 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:

enter image description here

GitHub issue expected to fix in v15.5

2
  • 2
    I 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.
    – eka808
    Jun 5, 2018 at 17:31
  • 1
    I guess you have VS later that 15.5. Current release is 15.7
    – Dmitry
    Jun 5, 2018 at 17:45
19

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
2
  • 4
    Btw. now it is doable from VS, so no need to close, just click Tools->Get Tools And Features Dec 29, 2017 at 16:25
  • 1
    Yes, you are right @ArturKarbone, although the installer mostly closes VS on its own then. May 9, 2018 at 4:51
7

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.

4

In addition to @ericgol's answer: In the French version of Visual Studio Community 2017, type "Concepteur de classes" in the search bar.

3
  • 3
    in German: "Klassen Designer" :) - funny thing, MS doesn't recognize it's own default language in localized search......
    – dba
    Feb 8, 2018 at 10:13
  • This post does not seem to provide a quality answer to the question. May 17, 2018 at 5:50
  • 1
    sɐ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.
    – LePatay
    May 17, 2018 at 7:06
4
  1. 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.

  2. Select the Individual components tab, and then scroll down to the Code tools category.

  3. Select Class Designer and then select Modify.

Visual Studio Installer Window

The Class Designer component starts installing.

For more details, visit this link: How to: Add class diagrams to projects

1

I am using VS 2017 Enterprise, you can find an option to install the class diagram extension using he Quick Launch in VS.

1
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.