bnl-dotnet
0.5.0
See the version list below for details.
dotnet tool install --global bnl-dotnet --version 0.5.0
dotnet new tool-manifest
dotnet tool install --local bnl-dotnet --version 0.5.0
#tool dotnet:?package=bnl-dotnet&version=0.5.0
nuke :add-package bnl-dotnet --version 0.5.0
DiagramGenerator for .NET (bnl-dotnet)
Turns a C#/ASP.NET Core solution into navigable Mermaid flow diagrams via Roslyn - entirely on your own machine. Your source code is analyzed locally and never leaves it; nothing is ever uploaded anywhere.
Install
dotnet tool install -g bnl-dotnet
Quick start
Run it from the folder containing your API, the way you would dotnet build:
# Free - diagram a single method in isolation, no license needed.
bnl-dotnet basic OrderService.Create
# Licensed - list the controller actions, then diagram one with everything it calls.
bnl-dotnet endpoint
bnl-dotnet endpoint OrdersController.GetById
Commands
| Command | Tier | What it does |
|---|---|---|
basic [path] |
Free | Lists every analyzable method, in the form to type back in. |
basic [path] <method> |
Free | Diagrams one method in isolation - full LINQ decomposition and call styling, but never follows a call into another method's own diagram. |
endpoint [path] |
Paid | Lists every controller action (ASP.NET Core Web API entry point). |
endpoint [path] <action> |
Paid | Full composed diagram for one controller action - every method it reaches, spliced into one page. |
method [path] |
Paid | Lists every analyzable method - broader than endpoint, not just controller actions. |
method [path] <method> |
Paid | Full composed diagram starting from any method - the paid counterpart to basic. |
license <key> |
- | Activates a license key locally, so it's picked up by every future run. |
Finding your project. [path] is a .sln, .slnx or .csproj (or a folder containing one). Leave it out and the one in the current folder is used - a solution if there is exactly one, otherwise the one project; if there are several, you're asked to pick. With a single argument, it's treated as the project if it looks like one and as the method otherwise, so bnl-dotnet endpoint OrdersController.Get just works.
Naming a method. Write Type.Method. Add the namespace (Orders.Api.OrdersController.Get) if the same type name exists in two places, and parameter types (OrdersController.Get(int)) to pick one overload. If a name matches several methods the tool lists them and stops rather than guessing. The lists above print each method in the form to type back in.
Choosing from a menu
Don't know the method's name? Run any of basic, endpoint or method with -i:
bnl-dotnet basic --interactive
bnl-dotnet endpoint -i
You get one alphabetical list (for endpoint, each controller action with its HTTP verb and route), 15 rows to a page. Use the up/down arrows to move and page, or just start typing to filter the list; press Enter to generate the diagram for the highlighted entry. The equivalent typed command is printed, so you can skip the menu next time. --interactive needs a terminal, so it can't be used when output is piped, and can't be combined with --stdout or with a method name.
Output
By default the diagram is written to <Type.Method>.mmd in the current folder. Options (all commands unless noted):
| Option | What it does |
|---|---|
-o, --output <path> |
Write to this file - or, if it's a folder (existing, or ending in /), to <Type.Method>.mmd inside it. Missing folders are created. |
--stdout |
Write the diagram to standard output and nothing else, so it can be redirected or piped. Can't be combined with -o. |
-f, --format <mermaid\|markdown> |
mermaid (default) is the bare diagram; markdown wraps it in a ```mermaid fence (.md) so it renders on GitHub or in a README/PR. |
--depth <n> |
endpoint/method only. How many levels of calls to follow (default 25). 1 draws just the starting method. |
-i, --interactive |
Choose the method from a menu instead of naming it - see below. |
-q, --quiet |
Suppress informational output. |
--verbose |
Show every message MSBuild produced while loading the project. A long list is otherwise summarized in one line. |
--version |
Print the tool version. |
bnl-dotnet endpoint OrdersController.GetById --stdout > orders-get.mmd
bnl-dotnet endpoint OrdersController.GetById -o docs/ --format markdown
With --stdout, STDOUT carries only the diagram: the license line, progress spinner and notes are not printed at all. A successful run writes nothing to STDERR; errors (and any license warning that needs your attention) go to STDERR with a non-zero exit code for errors, and nothing is written to STDOUT when a run fails. Exit codes are otherwise unchanged: 0 on success, non-zero on failure.
When STDOUT is piped, endpoint and method with no method print one reference per line (no table, no extra output), so bnl-dotnet endpoint | fzf works.
Windows PowerShell 5.1: its
>operator re-encodes output as UTF-16. Use-othere (PowerShell 7 and other shells are fine).
Licensing
basic is free forever, with no signup. endpoint and method need an Individual ($39.99/year) or Team license - see dotnet.boxesnlines.com/pricing. After subscribing you'll get a license key by email; activate it once with:
bnl-dotnet license dgcli_...
This persists the key locally (under your user profile), so it's picked up automatically on every later run - no need to pass it again. For CI, set it via an environment variable instead, so nothing needs to be written to the build agent's disk:
export BNL_DOTNET_LICENSE=dgcli_...
The license works fully offline day to day - the CLI checks in with the license server only as your key nears its renewal date, and only to fetch a freshly-dated key if your subscription is still active. If that check can't reach the server at all (no network, an air-gapped CI runner, a transient outage), the CLI keeps working on the last-known-good key for a generous grace period rather than breaking your pipeline over a connectivity gap - only an explicit "this subscription has lapsed" from a reachable server stops it immediately. Keys are never tied to a specific machine, so the same key works wherever you run the tool.
Every command prints a one-line License: ... status so it's always visible what tier you're running as.
License
bnl-dotnet is proprietary software, free to use for the basic command and licensed per subscription for the rest. The terms are in LICENSE.txt in this package; bundled open-source components are listed in THIRD-PARTY-NOTICES.txt.
Full documentation: dotnet.boxesnlines.com/docs.
| Product | Versions 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. |
This package has no dependencies.