A .NET CLI tool that generates Sphinx-compatible API reference files from a .NET project. It reads the API JSON produced by the Lunet extractor and writes reStructuredText (.rst) or MyST Markdown (.md) pages that use the sphinxcontrib-dotnetdomain dn: directives.
- .NET 10 SDK or later
- A Sphinx project with
sphinxcontrib-dotnetdomaininstalled
Publish the tool locally so that its bundled extractor assets are available at runtime:
dotnet publish src/DotNetSphinx -c Release -o out /p:UseAppHost=falseThen invoke the published binary:
dotnet out/DotNetSphinx.dll generate -p path/to/MyLibrary.csproj -o docs/apidotnet DotNetSphinx.dll generate --project <path> --output <dir> [options]
| Option | Short | Description | Default |
|---|---|---|---|
--project |
-p |
Path to the .csproj file |
(required) |
--output |
-o |
Output directory for generated files | (required) |
--config |
-c |
Build configuration | Release |
--framework |
-f |
Target framework moniker (e.g. net8.0) |
(auto) |
--rst |
Emit reStructuredText .rst files |
(default) | |
--md |
Emit MyST Markdown .md files |
||
--suppress-config |
Path to a suppress config JSON file | ||
--max-slug-length |
Maximum filename slug length | 96 |
Install the domain extension:
pip install sphinxcontrib-dotnetdomainAdd it to your conf.py:
extensions = [
"sphinxcontrib.dotnetdomain",
# ... other extensions
]Then add the generated index.rst (or index.md) to a toctree in your Sphinx project.
Pass --suppress-config path/to/suppress.json to hide internal types and control cross-reference rendering. Example:
{
"suppressTypes": [
"MyAssembly.Internal.HelperClass"
],
"suppressNamespaces": [
"MyAssembly.Internal.*"
],
"suppressSourceAssemblies": [
"MyAssembly"
],
"suppressXrefPrefixes": [
"ThirdParty."
],
"ignoreAttributes": [
"DebuggerDisplay",
"EditorBrowsable"
]
}| Key | Effect |
|---|---|
suppressTypes |
Fully-qualified type names to exclude from output |
suppressNamespaces |
Glob patterns for namespaces to exclude |
suppressSourceAssemblies |
Assemblies for which source links are omitted |
suppressXrefPrefixes |
UID prefixes rendered as code literals instead of :any: cross-references |
ignoreAttributes |
C# attributes stripped from displayed syntax blocks |
"Extractor props not found" — The tool must be run from a published output directory, not directly via dotnet run. Publish first with the command above.
No *.api.json files produced — Run a clean build before generating:
dotnet clean && dotnet publish src/DotNetSphinx -c Release -o out /p:UseAppHost=false
dotnet out/DotNetSphinx.dll generate -p path/to/MyLibrary.csproj -o docs/apiSphinx warns about unknown dn: roles — Ensure sphinxcontrib-dotnetdomain is installed and listed in conf.py extensions.
Read the project announcement and background on the LeXtudio blog: https://docs.lextudio.com/blog/a-brief-history-of-dotnet-documentation-tools-and-the-new-dotnet-sphinx/
This project uses Lunet (included as a submodule) for API extraction and model handling.
MIT — see LICENSE.
Copyright (c) 2026 LeXtudio Inc. All rights reserved.