🌐
NuGet
nuget.org › packages › docfx
NuGet Gallery | docfx 2.78.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support. ... Build your technical documentation site with docfx, with landing pages, markdown, API reference docs for .NET, REST API and more.
Statistics
Got questions about NuGet or the NuGet Gallery · Find out the service status of NuGet.org and its related services
Packages
Include compatible frameworks · Framework Filter Mode Decides whether to show packages matching ALL of the selected Target Frameworks (TFMs), or ANY of them
Downloads
NuGet 4.x is included in the Visual Studio 2017 installation. Latest NuGet releases are delivered as part of Visual Studio updates · Got questions about NuGet or the NuGet Gallery
Upload
Got questions about NuGet or the NuGet Gallery · Find out the service status of NuGet.org and its related services
🌐
NuGet
nuget.org › profiles › docfx
NuGet Gallery | docfx
This is a DocFX tool to merge developer comments.
🌐
.NEXT
dotnet.github.io › docfx
Quick Start | docfx - Microsoft .NET - GitHub Pages
Docfx publishes nightly builds to GitHub Packages. If you want to use prerelease version, you can install package with following steps. Install GitHub CLI command. Install PowerShell 7.x or later. Open PowerShell on working directory. ... Follow the instructions and complete the login steps. ... # Gets Access Token $token = gh auth token # Gets the version of latest nightly build $version = gh api /orgs/dotnet/packages/nuget/docfx/versions --jq '.[0].name' # Gets nupkg download URL.
🌐
NuGet
nuget.org › packages › docfx.console
NuGet Gallery | docfx.console 2.59.4
September 7, 2022 - This is a tool to generate API documentation for .NET projects.
🌐
NuGet
nuget.org › packages › docfx-plus
NuGet Gallery | docfx-plus 3.6.0
A dotnet tool for enhancing docfx behaviour and template/theme.
🌐
NuGet
nuget.org › packages › docfx › 2.72.0
NuGet Gallery | docfx 2.72.0
October 24, 2023 - The NuGet Team does not provide support for this client. Please contact its maintainers for support. ... Build your technical documentation site with docfx, with landing pages, markdown, API reference docs for .NET, REST API and more.
🌐
NuGet
nuget.org › packages › Docfx.Build.Common › 2.72.1
NuGet Gallery | Docfx.Build.Common 2.72.1
Technical documentation tool with markdown, API docs for .NET, REST API and more.
🌐
.NEXT
dotnet.github.io › docfx › tutorial › docfx_getting_started.html
Github
October 20, 2021 - Docfx publishes nightly builds to GitHub Packages. If you want to use prerelease version, you can install package with following steps. Install GitHub CLI command. Install PowerShell 7.x or later. Open PowerShell on working directory. ... Follow the instructions and complete the login steps. ... # Gets Access Token $token = gh auth token # Gets the version of latest nightly build $version = gh api /orgs/dotnet/packages/nuget...
🌐
NuGet
nuget.org › packages › Docfx.Dotnet › 2.73.1
NuGet Gallery | Docfx.Dotnet 2.73.1
November 7, 2023 - Technical documentation tool with markdown, API docs for .NET, REST API and more.
🌐
.NEXT
dotnet.github.io › docfx › extensions › packages.html
Packages | docfx
docfx init: nuget install rest.operationpage -OutputDirectory <output>
Find elsewhere
Top answer
1 of 1
3

If you specify an assembly in the metadata configuration, DocFx will look for the XML documentation in the same directory (source). The problem, however, is that when you include a NuGet reference, that XML documentation isn't included in your project's bin folder, even if it's included in the NuGet package. As a result, while DocFx is able to identify the structure, it is not able to identify the documentation.

TL;DR: To resolve this, you can configure msbuild to copy the XML documentation to the bin folder, ensuring DocFx has access to it (example). Details below.

Background

When you reference a NuGet package, by default, the package is downloaded, unzipped, and cached in the following location:

%UserProfile%\.nuget\packages\{Package}\{Version}\

Note: This is obviously a Windows directory; the location will vary by operating system.

This will include e.g.,

\lib\net6.0\{AssemblyName}.dll
\lib\net6.0\{AssemblyName}.xml

When you build your .NET project, the {AssemblyName}.dll is copied to your project's bin directory, but not the {AssemblyName}.xml. Since you've instructed DocFx to look in your project's bin folder, it is therefore unable to collect the documentation.

Naïve Workaround

The obvious workaround would be to simply source the metadata from the NuGet cache directly. This can easily be accomplished by adjusting the docfx.json configuration as follows:

{
  "metadata": [
    {
      "src": [
        {
          "files": "bin/Release/net6.0/{AssemblyName}.dll",
          "src": "C:\\Users\\{User}\\.nuget\\packages\\{Package}\\{Version}\\lib\\net6.0\\"
        }
      ],
      "dest": "api/{AssemblyName}"
    }
  ]
  …
}

This works, of course. But it's also a really brittle solution that isn't feasible for production code. Most notably, DocFx doesn't recognize the %UserProfile% alias, and so the {User} must be hardcoded into the configuration. Not only will this be different for each developer, but it will also be different on the build server. And that's not even factoring in non-Windows environments.

A better solution

Given this, the better solution is to instruct msbuild to copy the XML documentation to the bin folder along with the assembly. Fortunately, that's pretty easy, as discussed in How to include XML Documentation from Nuget Package in csproj build output. In your csproj file, simply add the following:

<Project>
  <Target Name="_ResolveCopyLocalNuGetPkgXmls" AfterTargets="ResolveReferences">
    <ItemGroup>
      <ReferenceCopyLocalPaths Include="@(ReferenceCopyLocalPaths->'%(RootDir)%(Directory)%(Filename).xml')"
      Condition="'%(ReferenceCopyLocalPaths.NuGetPackageId)'!='' and Exists('%(RootDir)%(Directory)%(Filename).xml')" />
    </ItemGroup>
  </Target>
</Project>

The main advantage of this approach is that it relies on msbuild variable to abstract the location of the NuGet cache, the package name, the version number, and the destination folder. As a result, this should work on any machine or operating system.

With this in place, DocFx will successfully find the XML documentation alongside the assembly, and include it in the generated yml metadata.

🌐
GitHub
github.com › dotnet › docfx › pkgs › nuget › docfx
Package docfx · GitHub
The docfx command line tool published as .NET tool · Learn more about NuGet packages · $ dotnet add package docfx --version 2.78.5-preview.84 · 2.78.5-preview.84 · Latest · Published 1 day ago · 0 · 2.78.5-preview.83 · Published 3 days ago · 0 · 2.78.5-preview.82 ·
🌐
NuGet Must Haves
nugetmusthaves.com › package › docfx.console
docfx.console - NuGet Must Haves Package
September 7, 2022 - NuGet .NET CLI Paket CLIR Direct Download · Install-Package docfx.console · dotnet add package docfx.console · paket add docfx.console · docfx.console Download&nbsp(Unzip the "nupkg" after downloading) 7 packages depend on this package. docascode · docfx ·
🌐
NuGet
nuget.org › packages › Docfx.App
NuGet Gallery | Docfx.App 2.78.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support. ... Build your technical documentation site with docfx, with landing pages, markdown, API reference docs for .NET, REST API and more.
🌐
Esri Developer
developers.arcgis.com › net › api-reference › ReadMe.html
DocFX consists mainly of two tools
DocFX generates metadata separately for each NuGet package (and each runs as its own metadata pass). Because of this, DocFX only sees the types that exist within a single pass and it has no visibility into classes defined in other packages.