Reference
Command line & MCP
Drive Glass headlessly from CI and coding agents: decompile, a public-API diff with a breaking-change gate, NuGet version diff, obfuscation inspection, project export, SBOM, and an MCP server.
Glass is primarily a desktop app, but since 1.3.0 it also ships a free, headless command-line tool — the same decompiler engine, with no GUI and no Avalonia dependency — for CI pipelines and coding agents. No license, no account.
Install
The CLI is a .NET global tool:
dotnet tool install -g Glass.NET.Tool
That gives you the glass command (requires the .NET 8 runtime). Every GitHub release also attaches the Glass.NET.Tool.<version>.nupkg if you prefer to install from a local file.
Commands
glass decompile <assembly> [--type <ReflectionName>] [--out <file>]
glass diff <old.dll> <new.dll> [--fail-on-breaking] [--json|--md]
glass nuget-diff <PackageId> <oldVersion> <newVersion> [--tfm <tfm>] [--fail-on-breaking] [--json|--md]
glass export <assembly> --out <folder>
glass sbom <.csproj | folder | project.assets.json> [--out <file>]
glass inspect <assembly> [--html <file>] [--json]
glass mcp
glass --version | --help
decompile
Decompile a whole assembly, or a single type, to C#. Prints to stdout, or writes a file with --out.
glass decompile MyApp.dll --type MyApp.Services.Billing --out Billing.cs
diff — the CI breaking-change gate
Compares the public API surface of two assemblies and classifies every change as breaking (a removed or changed public/protected member) or additive. With --fail-on-breaking, Glass exits 2 when any breaking change is found — so a pipeline can block a PR that breaks consumers:
glass diff baseline/MyLib.dll build/MyLib.dll --fail-on-breaking
# exit 0 = compatible · exit 2 = breaking changes
Add --json for machine-readable output or --md for a Markdown table (handy in PR comments).
nuget-diff
The same diff, but it downloads two versions straight from nuget.org — no local build needed:
glass nuget-diff Newtonsoft.Json 12.0.3 13.0.3 --fail-on-breaking
Use --tfm net8.0 to pin a target framework when a package ships several.
inspect
An exposure report: how many public types and methods are readable, how many embedded strings and possible secrets, and a plain-language verdict — with a recommendation to protect the assembly. --html writes a shareable report; --json emits structured output.
glass inspect MyApp.dll --html exposure.html
export & sbom
export reconstructs a buildable SDK-style C# project from an assembly. sbom emits a CycloneDX 1.5 SBOM of a project’s restored NuGet dependencies (run dotnet restore first).
glass export MyApp.dll --out ./recovered
glass sbom ./MyApp.csproj --out sbom.cdx.json
Exit codes
| Code | Meaning |
|---|---|
0 | Success |
2 | Breaking API changes found (with --fail-on-breaking) |
1 | Any other error (bad usage, file not found, failure) |
Results go to stdout; diagnostics go to stderr, so a CI job can route them separately.
MCP server (coding agents)
glass mcp runs a Model Context Protocol server over stdio, exposing decompile, diff, nuget_diff and inspect as tools. Point an MCP-capable agent — Claude Code, Cursor, Copilot — at the glass mcp command and it can decompile, diff and inspect assemblies on your behalf. Every answer is grounded in the real IL, not a guess.
A typical client entry runs the command glass with the single argument mcp.
CI example (GitHub Actions)
Gate a library’s PRs on API compatibility against the last release:
- run: dotnet tool install -g Glass.NET.Tool
- run: glass nuget-diff MyLib "$LAST_RELEASE" "$PR_VERSION" --fail-on-breaking
A removed or changed public member fails the step; purely additive changes pass.
Static analysis only
Like the desktop app, the CLI never executes the target assembly — everything is static metadata and IL analysis.