Reputation: 142
I want to create something like API documentation website for a .NET project. As per .NET Docs the XML comments that we put on top of methods, classes etc. can be processed into an XML file by the compiler and that file can be run through tools like DocFX to generate the documentation website. .NET Docs does not provide any instructions for the latter and DocFX documentation also does not give any hint on how to use that XML file to create API documentation website.
Any ideas on how can I use that XML file with DocFX to generate API Documentation Website?
Upvotes: 9
Views: 7188
Reputation: 3014
If you are using .NET Core 2.2 or greater, you can update your docfx.json
to directly extract metadata from .dll
and .xml
.
DocFX "will lookup for the XML file in the same folder" with the same file name as .dll
.
Example:
{
"metadata": [
{
"src": "bin/Release/netstandard2.0/YourCompany.YourNamespace.dll",
"dest": "obj/api"
}
]
}
You should also include <GenerateDocumentationFile>true</GenerateDocumentationFile>
into your .csproj
file.
Upvotes: 5
Reputation: 5105
For anyone stumbling across this, DocFX can be used from Visual Studio 2017 and later directly:
docfx.console
NuGet package to the project containing the XML documentation._site
folder will be generated in the same folder where the project's .csproj
file resides. That folder contains the documentation (access via the index.html
file).Source: DocFX Documentation
Upvotes: 2