How to add a Class Diagram to an ASP.NET Core project in VS 2017?
Solution 1
Well as answered here, this is a known issue (VOTE for MS to fix it!)
As a workaround, From the New File dialog box create a plain XML named Diagram.cd
(replace Diagram
with your choice), right click the file and select Open With..., and select XML (Text) Editor, then replace its contents with the following:
<?xml version="1.0" encoding="utf-8" ?>
<ClassDiagram MajorVersion="1" MinorVersion="1">
<Font Name="Segoe UI" Size="9" />
</ClassDiagram>
Then close the file saving it. When you reopen it normally it should work now.
Solution 2
I used Type Dependency Diagram
and it worked perfectly for me. Find the class that you want to explore:
Mouse: Right Button Click → Show Type Dependency Diagram
Then just drag and drop all your other related class and Visual Studio will build a nice diagram for you.
Comments
-
serge almost 2 years
I followed the How to: Add class diagrams to projects, but I have no "Class Diagram" template in my ASP.NET Core project after installing the ClassDiagram Visual Studio Component (I restarted Visual Studio after the installation of the component):
Microsoft Visual Studio Enterprise 2017 Version 15.8.7 VisualStudio.15.Release/15.8.7+28010.2046 Microsoft .NET Framework Version 4.7.03056 Installed Version: Enterprise Visual C++ 2017 00369-60000-00001-AA695 Microsoft Visual C++ 2017 ASP.NET and Web Tools 2017 15.8.05085.0 ASP.NET and Web Tools 2017 ASP.NET Core Razor Language Services 15.8.31590 Provides languages services for ASP.NET Core Razor. ASP.NET Web Frameworks and Tools 2012 4.0.30625.0 For additional information, visit https://www.asp.net/ ASP.NET Web Frameworks and Tools 2017 5.2.60618.0 For additional information, visit https://www.asp.net/ Azure App Service Tools v3.0.0 15.8.05023.0 Azure App Service Tools v3.0.0 Azure Functions and Web Jobs Tools 15.9.02009.0 Azure Functions and Web Jobs Tools C# Tools 2.9.0-beta8-63208-01 C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used. Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools. Devart Code Compare 4.2.236 Devart Code Compare Copyright (c) 2012-2017 Devart. All rights reserved. http://www.devart.com/codecompare/ JavaScript Language Service 2.0 JavaScript Language Service Microsoft Azure Tools 2.9 Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.10730.2 Microsoft Continuous Delivery Tools for Visual Studio 0.4 Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE. Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines Microsoft Library Manager 1.0 Install client-side libraries easily to any web project Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers Microsoft Visual C++ Wizards 1.0 Microsoft Visual C++ Wizards Microsoft Visual Studio Tools for Containers 1.1 Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container. Microsoft Visual Studio VC Package 1.0 Microsoft Visual Studio VC Package NuGet Package Manager 4.6.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/. ProjectServicesPackage Extension 1.0 ProjectServicesPackage Visual Studio Extension Detailed Info ResourcePackage Extension 1.0 ResourcePackage Visual Studio Extension Detailed Info ResourcePackage Extension 1.0 ResourcePackage Visual Studio Extension Detailed Info Snapshot Debugging Extension 1.0 Snapshot Debugging Visual Studio Extension Detailed Info SQL Server Data Tools 15.1.61808.07020 Microsoft SQL Server Data Tools TypeScript Tools 15.8.20822.2001 TypeScript Tools for Microsoft Visual Studio Visual Basic Tools 2.9.0-beta8-63208-01 Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used. Visual F# Tools 10.2 for F# 4.5 15.8.0.0. Commit Hash: 55a3dc3231c95c77f81ee53f7d29152029da7408. Microsoft Visual F# Tools 10.2 for F# 4.5 Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio Visual Studio Tools for Containers 1.0 Visual Studio Tools for Containers
-
JoeT about 4 yearsWorked for me but I believe this is a ReSharper feature and is not built into Visual Studio.