MkDocsSharp.MDGen 2.1.0

dotnet add package MkDocsSharp.MDGen --version 2.1.0
                    
NuGet\Install-Package MkDocsSharp.MDGen -Version 2.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MkDocsSharp.MDGen" Version="2.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MkDocsSharp.MDGen" Version="2.1.0" />
                    
Directory.Packages.props
<PackageReference Include="MkDocsSharp.MDGen" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MkDocsSharp.MDGen --version 2.1.0
                    
#r "nuget: MkDocsSharp.MDGen, 2.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MkDocsSharp.MDGen@2.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MkDocsSharp.MDGen&version=2.1.0
                    
Install as a Cake Addin
#tool nuget:?package=MkDocsSharp.MDGen&version=2.1.0
                    
Install as a Cake Tool

MkDocsSharp.MDGen

BannerOrSplash

NuGet CI

Automatically generate MkDocs-friendly Markdown from your C# XML documentation comments. Runs as an MSBuild task during your build process.

Installation

dotnet add package MkDocsSharp.MDGen

Quick Start

  1. Enable XML documentation in your project:
<PropertyGroup>
  <GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
  1. Build your project. The package automatically generates docs/index.md from your XML docs.

That's it! Your XML documentation comments are now converted to Markdown on every build, ready for MkDocs.

Features

  • Converts all standard XML documentation tags (<summary>, <param>, <returns>, <example>, etc.)
  • Outputs directly to docs/ for seamless MkDocs integration
  • Merges generated docs with existing Markdown files in docs/
  • Supports cross-references with <see cref="..."/> converted to Markdown links
  • Handles generic types, interfaces, enums, records, and structs
  • Runs automatically as part of your build process

Configuration

The default behavior works for most projects. The generated output goes to docs/index.md, and any existing .md files in docs/ are merged into the output.

To customize, you can override the MSBuild target in your .csproj:

<Target Name="AfterBuild" DependsOnTargets="GenerateMarkdownDocs">
  <GenerateMarkdown
    InputXml="$(OutputPath)$(AssemblyName).xml"
    DocumentationPath="$(MSBuildProjectDirectory)\Docs"
    MergeFiles="true"
    OutputFile="$(MSBuildProjectDirectory)\API.md"
    WarnOnUnexpectedTag="true"
  />
</Target>
Property Default Description
InputXml $(OutputPath)$(AssemblyName).xml XML documentation file(s) to process
DocumentationPath docs Folder containing existing Markdown to merge
MergeFiles true Whether to merge with existing docs
OutputFile docs/index.md Output Markdown file path
WarnOnUnexpectedTag false Warn on unrecognized XML tags

CLI Usage

The package also includes a standalone command-line tool:

MkDocsSharp.MDGen -i MyAssembly.xml -o API.md
Option Description
-i, --inputfile Input XML file
-o, --outputfile Output Markdown file
--cin Read from stdin
--cout Write to stdout

Requirements

  • .NET 8.0 or later
  • XML documentation enabled in your project

Contributing

See CONTRIBUTING.md for development setup and release process.

License

MIT - see LICENSE for details.


Originally forked from lontivero's gist.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.0 110 2/11/2026
2.0.0 106 2/11/2026
1.7.0 109 2/11/2026
1.6.0 134 2/1/2026
1.2.0 115 1/31/2026