Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create website from XML documentation comments? [closed]

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?

like image 562
Colonel Panic Avatar asked Mar 06 '14 14:03

Colonel Panic


People also ask

How do I enable XML comment analysis?

Enabling XML Comments XML comments are enabled by default in Visual Basic projects, and cannot be disabled. To enable or disable XML comments for a specific project, go to the project properties page, the Compile tab, and update the "Generate XML documentation file" checkbox.

When to use XML comments C#?

C# documentation comments use XML elements to define the structure of the output documentation. One consequence of this feature is that you can add any valid XML in your documentation comments. The C# compiler copies these elements into the output XML file.

How to comment XML?

An XML comment encountered outside the document type declaration is represented by the Comment value syntax element. It contains the comment text from the XML message. If the value of the element contains the character sequence --> , the sequence is replaced with the text --&gt; .

What is the purpose of XML comments in dotnet?

The XML comments are used to build API documentation which is readable by external tools. IntelliSense also reads these, and uses the contents to show the docs for your code in the assistance tooltips as you type (and in the Documentation window).


2 Answers

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.

like image 148
Jon Skeet Avatar answered Oct 18 '22 23:10

Jon Skeet


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.

like image 4
Geaz Avatar answered Oct 19 '22 00:10

Geaz