Xml2Doc.MSBuild 2.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Xml2Doc.MSBuild --version 2.0.1
                    
NuGet\Install-Package Xml2Doc.MSBuild -Version 2.0.1
                    
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="Xml2Doc.MSBuild" Version="2.0.1">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Xml2Doc.MSBuild" Version="2.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Xml2Doc.MSBuild">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
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 Xml2Doc.MSBuild --version 2.0.1
                    
#r "nuget: Xml2Doc.MSBuild, 2.0.1"
                    
#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 Xml2Doc.MSBuild@2.0.1
                    
#: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=Xml2Doc.MSBuild&version=2.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Xml2Doc.MSBuild&version=2.0.1
                    
Install as a Cake Tool

Xml2Doc.MSBuild

MSBuild integration for Xml2Doc, part of the mod-posh organization.

Overview

Xml2Doc.MSBuild adds automatic documentation generation to your build. After a successful compile, it converts the compiler-generated XML docs into Markdown using Xml2Doc.Core.

Multi-framework support (task host)

The task assembly is multi-targeted:

  • net472 — used by Visual Studio 2022 MSBuild (full .NET Framework host)
  • net8.0 — used by the dotnet SDK MSBuild

This means:

  • Building from VS UI / MSBuild.exe → task runs on net472.
  • Building from dotnet build → task runs on net8.0.

Output Markdown is identical regardless of host TFM. The package maps to the appropriate Xml2Doc.Core target under the hood.


Setup

Add a package reference to your project:

<ItemGroup>
  <PackageReference Include="Xml2Doc.MSBuild" Version="1.1.0" PrivateAssets="all" />
</ItemGroup>

That’s it—on successful build, docs are generated according to the properties below.


Configuration (MSBuild properties)

Property Description
Xml2Doc_Enabled Enable/disable generation. Default: true.
Xml2Doc_SingleFile true = generate one combined Markdown file; false = per-type files.
Xml2Doc_OutputFile Output file path when SingleFile=true (e.g. $(ProjectDir)docs\api.md).
Xml2Doc_OutputDir Output directory when SingleFile=false (e.g. $(ProjectDir)docs).
Xml2Doc_GenerateIndex Generate index.md in per-type mode. Default: true.
Xml2Doc_FileNameMode verbatim (keep generic arity) or clean (friendly generic names).
Xml2Doc_RootNamespaceToTrim Optional namespace prefix trimmed from display names.
Xml2Doc_CodeBlockLanguage Code block language for fenced blocks (default csharp).
Xml2Doc_PruneStaleFiles Remove stale files owned by this invocation. Default: false.
Xml2Doc_ManifestIdentity Stable identity required when stale-output pruning is enabled.
Xml2Doc_LineEndings Markdown newlines: lf (default), crlf, or native.

Examples

Single file (good for READMEs / wikis)

<PropertyGroup>
  <Xml2Doc_SingleFile>true</Xml2Doc_SingleFile>
  <Xml2Doc_OutputFile>$(ProjectDir)docs\api.md</Xml2Doc_OutputFile>
  <Xml2Doc_FileNameMode>clean</Xml2Doc_FileNameMode>
  <Xml2Doc_RootNamespaceToTrim>MyCompany.MyProduct</Xml2Doc_RootNamespaceToTrim>
</PropertyGroup>

Shared output directories: independent project builds cannot safely merge the same index.md. When projects share Xml2Doc_OutputDir, set Xml2Doc_GenerateIndex to false for those projects and create the repository-level index in a separate aggregation step:

<PropertyGroup>
  <Xml2Doc_OutputDir>$(SolutionDir)docs</Xml2Doc_OutputDir>
  <Xml2Doc_GenerateIndex>false</Xml2Doc_GenerateIndex>
</PropertyGroup>

Per-type files (good for large APIs)

<PropertyGroup>
  <Xml2Doc_SingleFile>false</Xml2Doc_SingleFile>
  <Xml2Doc_OutputDir>$(ProjectDir)docs</Xml2Doc_OutputDir>
  <Xml2Doc_FileNameMode>clean</Xml2Doc_FileNameMode>
</PropertyGroup>

Safely prune stale per-type output

<PropertyGroup>
  <Xml2Doc_SingleFile>false</Xml2Doc_SingleFile>
  <Xml2Doc_OutputDir>$(ProjectDir)docs</Xml2Doc_OutputDir>
  <Xml2Doc_PruneStaleFiles>true</Xml2Doc_PruneStaleFiles>
  <Xml2Doc_ManifestIdentity>$(MSBuildProjectFullPath)</Xml2Doc_ManifestIdentity>
</PropertyGroup>

Use an identity that remains stable for the same invocation. Only files recorded by that exact identity can be removed; hand-authored files and files owned by other builds are preserved. Pruning is supported only for per-type output.

Line-ending policy

Generated Markdown uses LF on every platform by default. Consumers that require another policy can select it explicitly:

<PropertyGroup>
  <Xml2Doc_LineEndings>crlf</Xml2Doc_LineEndings>
</PropertyGroup>

Use native only for host-specific compatibility. A .gitattributes rule such as *.md text eol=lf can reinforce repository policy but is not required for deterministic output.

Only generate in Release

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
  <Xml2Doc_Enabled>true</Xml2Doc_Enabled>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' != 'Release'">
  <Xml2Doc_Enabled>false</Xml2Doc_Enabled>
</PropertyGroup>

Visual Studio notes

  • The package includes a net472 task so it runs inside Visual Studio 2022 builds without extra tooling.
  • If you don’t see output, check Build Output for the Xml2Doc task messages and verify your project emits XML docs (<GenerateDocumentationFile>true</GenerateDocumentationFile>).

CI notes

  • Works with dotnet build (task will load the net8.0 target).

  • Recommended pattern:

    dotnet build MySolution.sln -c Release
    
  • Outputs are reproducible across hosts (VS vs. dotnet).


Troubleshooting

  • No files produced: ensure your project actually generates an XML doc file for the build config/TFM in use.
  • Want to disable temporarily? Set <Xml2Doc_Enabled>false</Xml2Doc_Enabled> in your .csproj or via /p:Xml2Doc_Enabled=false.

Versioning / Support

  • Task hosts: net472 (VS/MSBuild.exe), net8.0 (dotnet SDK).
  • Backed by Xml2Doc.Core targets: netstandard2.0;net8.0;net9.0 with identical rendering across TFMs.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Xml2Doc.MSBuild:

Package Downloads
Yaml2Doc.Markdown

Renderer library that converts the neutral pipeline model into human-friendly Markdown documentation.

Yaml2Doc.Core

Core library for parsing pipeline YAML into a neutral model for documentation.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.3.0 127 8/17/2026
2.2.0 137 8/17/2026
2.1.0 213 8/16/2026
2.0.3 183 8/15/2026
2.0.2 192 8/14/2026
2.0.1 102 8/14/2026
2.0.0 101 8/13/2026
2.0.0-preview.113-g69c1a44 50 8/13/2026
1.4.0 123 8/13/2026
1.4.0-preview.111-g7a5369b 55 8/13/2026
1.4.0-preview.110-g1edd8f0 58 8/13/2026
1.4.0-preview.109-g42abc6e 53 8/13/2026
1.4.0-preview.108-g611e3f5 50 8/13/2026
1.4.0-preview.107-gc4dc99b 55 8/13/2026
1.4.0-preview.106-gffe4bab 53 8/13/2026
1.4.0-preview.105-gd9e6cf3 57 8/13/2026
1.4.0-preview.104-gfa11148 51 8/13/2026
1.4.0-preview.103-gc413f43 46 8/13/2026
1.4.0-preview.102-g7ed4c9f 59 8/13/2026
1.4.0-preview.101-g1fbacd3 60 8/1/2026
Loading failed