views:

6996

answers:

8

Is there any kind of documentation generator for C#? Like something that would put the xml-ish documentation right above the method/class declarations? Is there a tool or is it tucked away somewhere in VS 2008?

+20  A: 

I recommend you to give a look to SandCastle. It generates class library documentation from .NET assemblies and the XML documentation files generated by the C# compiler. You may want to use the SandCastle GUI tools, SHFB, SandCastleGUI or DocProject which will ease completely the document generation process.

Also give a look to the recommended and allowed XML tags.

Update: I agree with the Matt's comment, NDoc is almost a dead project, and remember that you could use also the old XSLT way.

CMS
NDoc is out of date, you should be using Sandcastle. There are various GUI frontends for Sandcastle, such as this one: http://www.codeplex.com/SHFBor this one: http://www.inchl.nl/SandcastleGUI/
Matt Olenik
+1 for the nice collection of links. Tried to move the important pieces to the front for better readability.
David Schmitt
+5  A: 

You can start a comment with /// right above a class or class member and VS will insert some template documentation tags for you.

Joey
+12  A: 

I quite like GhostDoc

GhostDoc is a free add-in for Visual Studio that automatically generates XML documentation comments for C#. Either by using existing documentation inherited from base classes or implemented interfaces, or by deducing comments from name and type of e.g. methods, properties or parameters.

Basically it generates the /// comments above the methods, class, etc for you. They're not perfect but provide a good starting point.

Ray
I really disliked GhostDoc because it (can) serve as an excuse not to do the documentation correctly.
ullmark
@ullmark - `public void DataBind()` - `/// <summary>Datas the bind.</summary>`
Chris S
+1  A: 

As per Ray's suggestion, GhostDoc is handy, although it can lead to boilerplate docs without substance if developers are lazy.

As for publishing your docs...forget NDoc, it's a dead project.

Sandcastle is actively supported by Microsoft. You document using standard C# tags. It has multiple output formats and plenty of flexibility. Just give whatever box you build docs on plenty of RAM.

I recommend SHFB to make life easy with Sandcastle. Modeled after NDoc and works via GUI or command line.

Si
+2  A: 

As others have said, if you want to generate the comments in your code you should have a look at GhostDoc.

As for outputting the comments into something nice. I recently started an open-source project for generating documentation for .Net apps, as an alternative to Sandcastle. I don't want to get into the hows or whys I've done such a thing here, but you might want to check it out. It's early days yet, but it's making steady progress.

Docu - simple documentation done simply

James Gregory
+1  A: 

GhostDoc is great, but I did have a rant about adding comments some time ago. If you are going to add comments, make them usefull!.

Hace
+2  A: 

Now (over a year later) there is NDoc3. Very easy to use.

Robert Dondo
A: 

Live Documenter is a free documentation tool from The Box Software.

Barry Jones