How to create website from XML documentation comme

2019-06-21 04:53发布

问题:

I would like to create a documentation website from C# XML documentation comments.

An example from the Python community. This Scipy documentation is created from this python code using a tool named Sphinx.

Is anything like that possible for a C# project?


Example of XML documentation comments in a .NET project (not mine) https://github.com/haf/NodaTime/blob/master/src/NodaTime/Period.cs#L26

/// <summary>
/// Represents a period of time expressed in human chronological terms: hours, days,
/// weeks, months and so on. All implementations in Noda Time are immutable, and return fields
/// in descending size order: hours before minutes, for example.
/// </summary>
public sealed class Period : IEnumerable<DurationFieldValue>, IEquatable<Period>

Edit: The full extent of advice I could find in other questions was 'use Sandcastle'. As far as I can tell from its (ironically limited) documentation, it can only create Windows help files (.chm). Is that correct?

回答1:

Edit: The full extent of advice I could find in other questions was 'use Sandcastle'. As far as I can tell from its (ironically limited) documentation, it can only create Windows help files (.chm). Is that correct?

No, that's not correct. Sandcastle can build a wide range of output.

However, these days you really want Sandcastle Help-File Builder (SHFB) which makes things a whole lot better. Still not entirely painless, but pretty good. The documentation for SHFB is generally pretty reasonable, too.

Funny you should give an example of Noda Time - SHFB is precisely what we use to generate our online API reference.



回答2:

You could also try sharpDox. Another free and open source documentation generator. You are able to create html and chm output and soon word documents.

Here is an example for a html output.

P.S.: I am the creator of this tool.



回答3:

For a one-click solution, you can also try our VSdocman.