nugraph 0.5.0

dotnet tool install --global nugraph --version 0.5.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local nugraph --version 0.5.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=nugraph&version=0.5.0
                    
nuke :add-package nugraph --version 0.5.0
                    

nugraph is a .NET tool for creating visual dependency graphs of NuGet packages and .NET projects.

NuGet Continuous Integration

A picture is worth a thousand words, so here's the dependency graph produced by running

nugraph Microsoft.Extensions.Logging.Console

Dependency graph of Microsoft.Extensions.Logging.Console 9.0.6 (net8.0)

Installation

dotnet tool install --global nugraph

On macOS, the first time a .NET global tool is installed, the PATH environment variable must be adjusted.

Usage

nugraph can generate dependency graphs for either a single NuGet package or for an exising .NET project. Run nugraph --help to see all the supported options.

NuGet package mode

Run nugraph <NuGetPackageName> to generate the dependency graph of a NuGet package. For example, run nugraph Serilog.Sinks.File to generate the dependency graph of the Serilog.Sinks.File package.

A specific version can be explicitly requested by appending /version to the package name, for example nugraph Serilog.Sinks.File/4.1.0. When no version is specified, the latest version available on NuGet is chosen.

Many packages support multiple target frameworks and sometimes the dependencies varies across different target frameworks. A target framework is guessed automatically, but it can be overriden with the -f or --framework option.

.NET project mode

In addition to NuGet packages graphs, nugraph can also create graphs of .NET projects, i.e. .csproj, .fsproj and .vbproj files.

Without any argument, nugraph creates the graph of the project in the current working directory. An existing directory or an existing project file can also be passed explicitly. Under the hood, nugraph calls dotnet restore to resolve dependencies, so any private NuGet feeds configured in NuGet.config will just work.

Here's an example with an open source project that produces a large graph. The ignore option (-i) is used to remove all the System.* and Humanizer.Core.* packages to make the graph more readable. The --no-links option is also specified to smooth using the excellent Graphviz Interactive Preview extension for Visual Studio Code.

git clone https://github.com/nopSolutions/nopCommerce
nugraph nopCommerce/src/Presentation/Nop.Web/Nop.Web.csproj -o nopCommerce.gv -i "System.*" -i "Humanizer.Core.*" --no-links
code nopCommerce.gv

When a node is selected in Graphviz Interactive Preview, all the connected nodes are highlighted and the non-connected nodes are dimmed. This helps to understand how a single dependency is used. Here's what happens when the Microsoft.Data.SqlClient node is selected.

Dependency graph of Nop.Web with the Microsoft.Data.SqlClient node selected in Graphviz Interactive Preview

Package references are rendered in green and project references are rendered in blue. The hexagon shaped boxes represent the roots of the graph, i.e. the explicit package or project references in the project file.

Output

To write the dependency graph to a file, use the -o or --output options. If the output file name ends with either .mmd or .mermaid a Mermaid file will be written. Otherwise, a Graphviz file will be written. Suggested extensions for Graphviz files are .gv or .dot.

When no output options is specified, the format can be chosen with the -m or --format option. The default browser will be opened to one of the supported online services.

Mermaid
-m or --format mermaid.live mermaid.ink kroki.io
interactive (view) unspecified or mmd or mermaid
interactive (edit) mmd-edit or mermaid-edit
svg mmd.svg or mermaid.svg mmd.kroki.svg or mermaid.kroki.svg
png mmd.png or mermaid.png mmd.kroki.png or mermaid.kroki.png
jpg mmd.jpg or mermaid.jpg
webp mmd.webp or mermaid.webp

For example, run nugraph Microsoft.Data.SqlClient -m mmd.svg to open the graph as an SVG file rendered in the default browser using the Mermaid Ink service.

Graphviz
-m or --format edotor.net kroki.io
interactive or dot or gv
svg dot.svg or gv.svg
png dot.png or gv.png
jpg dot.jpg or gv.jpg
pdf dot.pdf or gv.pdf

For example, run nugraph Microsoft.Data.SqlClient -m dot to open the graph in the Edotor interactive service.

The interactive, SVG and PDF formats have clickable links to the nuget.org page of the packages, unless the --no-links option is specified.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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.

This package has no dependencies.

Version Downloads Last Updated
0.5.0 154 6/27/2025
0.4.0 147 6/26/2025
0.3.0 171 6/24/2025