Commands
dotnet docs add
Create and add a documentation project (.docsproj) to your solution.
Usage:
| Option | Alias | Description | Default |
|---|---|---|---|
--solution <PATH> | -s | Path to solution file (.sln or .slnx) | Current directory search |
--name <NAME> | Name for the docs project | {SolutionName}.Docs | |
--output <PATH> | -o | Output directory for docs project | Project folder |
--type <TYPE> | -t | Documentation type | Mintlify |
--prerelease | Use latest prerelease SDK version | Latest stable version |
Mintlify- Mintlify documentation with MDX support (default)DocFX- DocFX documentationMkDocs- MkDocs documentationJekyll- Jekyll documentationHugo- Hugo documentationGeneric- Generic markdown documentation
dotnet docs add queries NuGet.org to find the latest stable version of DotNetDocs.Sdk and uses it in the generated .docsproj file. Use --prerelease to get the latest preview version instead.
1
Locates Solution
Searches current directory for
.slnx (preferred) or .sln file if not specified2
Creates Project
Generates
.docsproj file with Mintlify configuration and default theme3
Adds to Solution
Adds project to solution in “Docs” solution folder
4
Post-Processing
For
.slnx files, adds Type="C#" attribute for proper Visual Studio support- Mintlify (Default)
- Other Types
dotnet docs update
Update existing.docsproj files to use the latest DotNetDocs.Sdk version from NuGet.
Usage:
| Option | Alias | Description | Default |
|---|---|---|---|
--project <NAME|PATH> | -p | Project name or path to .docsproj file to update | All .docsproj files in current directory |
--recursive | -r | Search recursively in subdirectories | Current directory only |
--prerelease | Update to latest prerelease SDK version | Latest stable version |
The
--project option accepts either a project name (e.g., MyProject.Docs) or a file path (e.g., MyProject.Docs.docsproj or path/to/MyProject.Docs.docsproj). If you provide just the project name, the tool will automatically append .docsproj to find the file.1
Query NuGet
Queries NuGet.org for the latest version of DotNetDocs.Sdk (stable or prerelease)
2
Find .docsproj Files
Locates all .docsproj files (or a specific file if —file is specified)
3
Update SDK References
Updates
Sdk="DotNetDocs.Sdk/X.X.X" to the latest version in each file4
Report Results
Shows which files were updated and which were skipped
This command is useful when a new version of DotNetDocs.Sdk is released and you want to upgrade your documentation projects without manually editing each file.
dotnet docs build
Build documentation from .NET assemblies and XML documentation files. Usage:| Option | Alias | Description | Default | Required |
|---|---|---|---|---|
--assembly-list <PATH> | -a | Path to file containing assembly list | ✅ | |
--output <PATH> | -o | Output path for documentation | ✅ | |
--type <TYPE> | -t | Documentation type | Mintlify | |
--namespace-mode <MODE> | -n | Namespace organization | File | |
--api-reference-path <PATH> | API reference subfolder | api-reference |
| Type | Description |
|---|---|
Mintlify | Mintlify-enhanced MDX with icons, navigation, and frontmatter (default) |
DocFX | DocFX-compatible documentation format |
MkDocs | MkDocs-compatible documentation format |
Jekyll | Jekyll-compatible documentation format |
Hugo | Hugo-compatible documentation format |
Generic | Generic Markdown documentation |
- File Mode (Default)
- Folder Mode
Each namespace gets a single file.Structure:Best for: Smaller projects, simpler file organization
assemblies.txt
Only assemblies with corresponding XML documentation files (
.xml) will be processed. Assemblies without XML docs are skipped.Complete Workflows
Quick Start Workflow
1
Add Documentation Project
.docsproj in your solution2
Build Your Projects
3
Create Assembly List
4
Generate Documentation
5
Preview Documentation
Multi-Project Workflow
For solutions with multiple projects:1
Build All Projects
2
Create Assembly List
assemblies.txt
3
Generate Unified Documentation
CI/CD Integration
- GitHub Actions
- Azure Pipelines
.github/workflows/docs.yml
Tips and Best Practices
Ensure XML Documentation
Ensure XML Documentation
Enable XML documentation in your Without XML files, assemblies are skipped during documentation generation.
.csproj files:Use Relative Paths
Use Relative Paths
Use relative paths in your assembly list file for portability across environments:
Organize Output
Organize Output
Choose namespace mode based on project size:
- File Mode: Better for small-to-medium projects (< 50 types)
- Folder Mode: Better for large projects (> 50 types)
Automate Assembly Lists
Automate Assembly Lists
Generate assembly lists dynamically in CI/CD:
Troubleshooting
No assemblies found to process
No assemblies found to process
Problem: Assembly list file is empty or paths are incorrectSolution:
- Verify assembly paths in the list file
- Ensure you’ve built projects in Release mode
- Check that paths are relative to where you’re running the command
Assemblies skipped (no XML docs)
Assemblies skipped (no XML docs)
Problem: Assemblies don’t have corresponding XML documentation filesSolution:
- Add
<GenerateDocumentationFile>true</GenerateDocumentationFile>to.csproj - Rebuild projects
- Verify
.xmlfiles exist next to.dllfiles
Solution file not found
Solution file not found
Problem:
dotnet docs add can’t find a solution fileSolution:- Run from directory containing
.slnor.slnxfile - Or specify solution path:
dotnet docs add --solution path/to/solution.sln
Documentation generation fails
Documentation generation fails
Problem: Errors during documentation buildSolution:
- Check that assemblies are valid .NET assemblies
- Ensure XML files match assembly structure
- Review console output for specific error messages