Command-line tool for Xml2Doc — convert C# XML documentation into Markdown directly from your terminal or CI pipeline. Supports single-file mode, filename options, and namespace trimming. Part of the mod-posh Xml2Doc suite.
$ dotnet add package Xml2Doc.CliCommand-line interface for Xml2Doc, part of the mod-posh organization.
Xml2Doc.Cli converts C# XML documentation into Markdown using the Xml2Doc.Core engine.
It’s ideal for developers and CI systems that want quick, repeatable Markdown docs from existing XML output.
The CLI is multi-targeted and ships for:
net8.0net9.0The rendered Markdown is identical across these TFMs. Choose whichever runtime you have available on the machine that runs the tool.
Build first, then run the produced DLL for the desired framework:
# Build both TFMs (default for the project)
dotnet build Xml2Doc/src/Xml2Doc.Cli/Xml2Doc.Cli.csproj -c Release
# Run the built artifact (net8.0)
dotnet Xml2Doc/src/Xml2Doc.Cli/bin/Release/net8.0/Xml2Doc.Cli.dll --xml path\to\MyLib.xml --out .\docs
# Or run the net9.0 artifact
dotnet Xml2Doc/src/Xml2Doc.Cli/bin/Release/net9.0/Xml2Doc.Cli.dll --xml path\to\MyLib.xml --out .\docs
Tip: Prefer running the built DLL as shown above. Using
dotnet runcan be confusing with multi-targeted projects; if you do use it, you must specify a single--frameworkthat exists in the csproj.
# Per-type documentation
Xml2Doc.exe --xml .\bin\Release\net9.0\MyLib.xml --out .\docs
# Single combined file
Xml2Doc.exe --xml .\bin\Release\net9.0\MyLib.xml --out .\docs\api.md --single --file-names clean
| Option | Description |
|---|---|
--xml <path> | Path to the XML documentation file |
--out <path> | Output directory (multi-file) or output file (single-file) |
--single | Combine all documentation into a single Markdown file |
--file-names <verbatim|clean> | Filename mode — preserve generics or shorten to readable form |
--rootns <namespace> | Optional root namespace to trim |
--lang <language> | Code block language (default: csharp) |
--config <file> | Path to a JSON configuration file |
--help | Display help text |
xml2doc.json
{
"Xml": "src/MyLib/bin/Release/net9.0/MyLib.xml",
"Out": "docs/api.md",
"Single": true,
"FileNames": "clean",
"RootNamespace": "MyCompany.MyProduct",
"CodeLanguage": "csharp"
}
Run with:
Xml2Doc.exe --config xml2doc.json
CLI flags always override values from the config file.
dotnet build -c Release), then run the desired built CLI DLL (net8.0 or net9.0).