Troubleshooting
ProjGraph reads source files rather than compiled assemblies, so when a diagram comes back empty it is almost always because it could not find the thing you meant, not because your code is wrong. This page maps the messages you might see onto what to do about them.
projgraph command not found
The tool installed, but your shell has not picked up the .NET global tools directory. Open a new terminal first — that resolves it most of the time.
If it persists, add the tools directory to your PATH:
# Linux and macOS
export PATH="$PATH:$HOME/.dotnet/tools"
# Windows (PowerShell)
$env:PATH += ";$env:USERPROFILE\.dotnet\tools"
Add the same line to your shell profile to make it stick.
File must be a .sln, .slnx, or .csproj file.
visualize and stats analyse a solution or a project, not a directory and not
a source file. Point them at the file itself:
projgraph visualize ./MySolution.slnx
projgraph stats ./src/MyApp/MyApp.csproj
No DbContext or ModelSnapshot .cs file found.
erd was given no path, and found nothing to analyse in the current directory.
It looks for files whose names end in DbContext.cs or that contain a model
snapshot.
Give it the path explicitly:
projgraph erd ./Data/LibraryContext.cs
If your context does not follow the *DbContext.cs naming convention, name it
directly with --context:
projgraph erd ./Data/Persistence.cs --context LibraryContext
The ERD is empty, or entities are missing
ProjGraph discovers entities from the DbSet<T> properties on your context, so
an entity that is not exposed as a DbSet will not appear unless something else
references it.
Work through these in order:
- Is the context
public? A non-public class is skipped. - Are the entities reachable? An entity registered only through
modelBuilder.Entity<T>()inOnModelCreating, with noDbSet, is found only if ProjGraph can resolve the type. - Do the entity types live in another project? ProjGraph searches the
workspace for them, starting from the nearest
.sln,.slnx, or.csproj. If your context and your entities are in unrelated directories with no solution file above them, it has nothing to search.
If the model is already migrated, the snapshot is the more reliable source, because EF has already resolved the model in full:
projgraph erd ./Migrations/LibraryContextModelSnapshot.cs
The class diagram shows one class and nothing else
That is the default. Base types and dependencies are opt-in, because following them across a large workspace is expensive:
projgraph classdiagram ./Models/Book.cs --inheritance --dependencies
Still missing types? Discovery only follows one level by default. Raise it:
projgraph classdiagram ./Models/Book.cs -i -d --depth 5
stats reports zero projects
The solution file parsed, but none of the projects it lists could be read. Usually one of:
- The
.csprojfiles it references have moved or been deleted. - The solution genuinely contains no projects.
- You pointed at a solution file in a different directory tree, so the relative project paths inside it no longer resolve.
Confirm the paths inside the solution file match what is on disk.
Parsing fails on newer C# syntax
ProjGraph parses with Roslyn, and the version of Roslyn it ships with sets the syntax it understands. If you use a language feature newer than the tool, parsing that file can fail.
Update the tool:
dotnet tool update -g ProjGraph.Cli
The MCP server returns nothing, or the client will not start it
The server speaks JSON-RPC over stdio, which means anything else written to stdout corrupts the protocol. If you are running a locally built copy, make sure nothing in your build writes to stdout on startup.
Check these in order:
- Is
dnxavailable? Rundnx --help. It ships with the .NET 10 SDK. - Is the version in your config real? Replace
x.x.xwith a published version from NuGet. - Did the client restart? Most MCP clients only read their server configuration at startup.
- Can the server see your files? The tools take paths, and the server can only read what its process can reach.
Still stuck
Open an issue at github.com/HandyS11/ProjGraph/issues with the command you ran and the output you got.