Getting started
bnl-dotnet reads your C# and draws what the code does - the decisions, loops, early returns and
calls - as a flow diagram. It runs entirely on your machine: your source is analyzed locally and never uploaded.
This page takes you from install to your first diagram, then shows a few common ways to use it. The
documentation has every command and option.
1. Install
You need the .NET 10 SDK (or newer). Then install the tool once, globally:
dotnet tool install -g bnl-dotnet
2. Draw your first diagram (free)
Run it from the folder containing your project, the way you would dotnet build. List the methods it can diagram, then name one:
bnl-dotnet basic
bnl-dotnet basic OrderService.Create
Don't know the name? bnl-dotnet basic -i gives you a menu you can type to filter. The diagram is written to
OrderService.Create.mmd in the current folder - Mermaid text that any Mermaid viewer can draw
(the Mermaid live editor, a VS Code Mermaid extension, and so on).
basic is free forever and needs no signup.
Rather see it in your editor? The VS Code extension
draws the diagram of whichever method your
cursor is in, and follows you as you move. It carries its own copy of the tool, so there's nothing to install
first. Its Method view is basic underneath and free; with a license, its
Full flow view is the composed diagram from step 3. See VS Code extension in the documentation.
3. Follow a whole request
With an Individual or Team license, endpoint follows a controller action into
every method it calls and splices them into one diagram. Activate your key once, then name an action:
bnl-dotnet license dgcli_...
bnl-dotnet endpoint
bnl-dotnet endpoint OrdersController.Checkout
The Sample page shows exactly this, against real code, side by side with the diagram it produced.
4. Add the variables
Add --format advanced to any of those commands and the diagram also traces every variable - where it comes
in, where it's read, where it's written, where it leaves. The result opens in draw.io.
See Advanced diagrams for how to read one.
bnl-dotnet endpoint OrdersController.Checkout --format advanced
Common use cases
Put a diagram in a README or pull request
--format markdown wraps the diagram in a ```mermaid fence, which GitHub draws for you in a
README, an issue or a pull request description.
bnl-dotnet endpoint OrdersController.Checkout -o docs/ --format markdown
Learn code you didn't write
Pick an endpoint from the menu and read the diagram before you read the code. The advanced format is the quickest way to see which values a method depends on and what it hands back.
bnl-dotnet endpoint -i --format advanced
Keep diagrams up to date in CI
Set your key as the BNL_DOTNET_LICENSE environment variable so nothing is written to the build agent's disk,
and use --stdout to send the diagram wherever you need it.
BNL_DOTNET_LICENSE=dgcli_... bnl-dotnet endpoint OrdersController.Checkout --stdout > docs/checkout.mmd
Diagram code that isn't an endpoint
method works like endpoint but starts from any method, not just controller actions - handy for
background jobs, message handlers and services.
bnl-dotnet method InvoiceJob.Run