ProjGraph.Lib.ClassDiagram 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ProjGraph.Lib.ClassDiagram --version 1.1.0
                    
NuGet\Install-Package ProjGraph.Lib.ClassDiagram -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ProjGraph.Lib.ClassDiagram" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ProjGraph.Lib.ClassDiagram" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="ProjGraph.Lib.ClassDiagram" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ProjGraph.Lib.ClassDiagram --version 1.1.0
                    
#r "nuget: ProjGraph.Lib.ClassDiagram, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ProjGraph.Lib.ClassDiagram@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ProjGraph.Lib.ClassDiagram&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=ProjGraph.Lib.ClassDiagram&version=1.1.0
                    
Install as a Cake Tool

ProjGraph.Lib.ClassDiagram

Roslyn-powered class hierarchy analysis and Mermaid class diagram generation for .NET projects.

NuGet License: MIT

Installation

dotnet add package ProjGraph.Lib.ClassDiagram

Overview

ProjGraph.Lib.ClassDiagram uses the Roslyn workspace API to analyze C# source code and generate Mermaid class diagrams. It supports:

  • Analyzing individual .cs files or entire project workspaces
  • Extracting classes, records, interfaces, abstract types, enums, and structs
  • Capturing fields, properties, methods, and their visibility modifiers
  • Detecting inheritance, implementation, and composition relationships
  • Configurable member visibility filters

Usage

Register all services:

using ProjGraph.Lib.Core;
using ProjGraph.Lib.ClassDiagram;

services.AddProjGraphCore();
services.AddProjGraphClassDiagram();

Generate a class diagram from a directory

using ProjGraph.Core.Models;
using ProjGraph.Lib.ClassDiagram.Application;
using ProjGraph.Lib.Core.Abstractions;

var analysisService = provider.GetRequiredService<IClassAnalysisService>();

var result = await analysisService.AnalyzeDirectoryAsync("src/MyProject", new AnalysisOptions(
    MaxDepth: 1,
    IncludeInheritance: true,
    IncludeDependencies: true));

var renderer = provider.GetRequiredService<IDiagramRenderer<ClassModel>>();
string diagram = renderer.Render(result);

Example output:

classDiagram
    class OrderService {
        +PlaceOrder(request OrderRequest) Task~Order~
        +CancelOrder(id Guid) Task
    }
    class IOrderRepository {
        <<interface>>
        +FindById(id Guid) Task~Order~
    }
    OrderService --> IOrderRepository

Analyze a single file or directory

using ProjGraph.Lib.ClassDiagram.Application.UseCases;

var analyzeFile = provider.GetRequiredService<AnalyzeFileUseCase>();
var fileModel = await analyzeFile.ExecuteAsync("src/Domain/Order.cs");

var analyzeDirectory = provider.GetRequiredService<AnalyzeDirectoryUseCase>();
var directoryModel = await analyzeDirectory.ExecuteAsync("src/Domain/");

Key Services

Service Description
IClassAnalysisService Orchestrates full Roslyn workspace analysis
AnalyzeFileUseCase Analyzes a single C# source file
AnalyzeDirectoryUseCase Analyzes all .cs files in a directory
MermaidClassDiagramRenderer Renders analysis results as a Mermaid class diagram
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ProjGraph.Lib.ClassDiagram:

Package Downloads
ProjGraph.Lib

Meta-package that bundles all ProjGraph libraries: project graph, class diagram, and Entity Framework analysis with a single DI registration.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.0 156 9/15/2026
1.2.0-beta.1 81 9/15/2026
1.1.0 138 8/7/2026
1.0.2 159 4/7/2026
1.0.1 139 4/4/2026
1.0.0 156 3/12/2026