开发者

Documentation from all comments in Visual Studio 2010 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

开发者_运维知识库

Closed 5 years ago.

Improve this question

How can create a documentation from all classes, methods and attributes comments in Visual Studio 2010 for the C# language?


Try Sandcastle and the Sandcastle Helpfile Builder. It creates CHMs and MSHelpfiles or HTML Pages in MSDN Style. Its simple to use and it can load Soultion Files.
Helpfile Builder with Sandcaste: http://shfb.codeplex.com/
Sandcastle only: http://sandcastle.codeplex.com/


You can create MSDN like documentation with Sandcastle


Doxygen will generate nice HTML documentation from the comments in your code, provided that you follow a few simple formatting rules.


First it is worth saying that it is commendable that you want to document the API of your libraries so that others (or even you at a future date:-) will be able to use your code without having to read your code. That is a great step in itself!

There are a variety of tools that help automate this task, notably Doxygen and Sandcastle, as others have previously mentioned. I have not used Doxygen so I will restrict my comments to Sandcastle. Sandcastle, provided by Microsoft, is a great starting point but apparently is quite difficult to use, hence a number of motivated independent developers built more usable interfaces on top of Sandcastle. The premier one of these is Sandcastle Help File Builder (SHFB). With the GUI of SHFB you "simply" create a Sandcastle project, set the project properties to your liking, then build your documentation set as a web site or a CHM file or a couple other formats.

I wrote simply in quotes above because working in SHFB is the smallest part of the task in front of you--the much more vast task is decorating your code with appropriate and correct documentation comments (doc-comments) that serve as the "source code" for Sandcastle or other documentation engine. It takes a substantial investment of your time and energy to document all your code but I believe, as you may have inferred, that it is definitely worth it. Besides the aforementioned reason that others will be able to use your code much more easily, I find that documenting my code has one other important benefit--it helps me write better code. As I start documenting a new method or class I often remark to myself "Oh, this parameter would be more clear if it was called Y rather than X." or "Oops--this method is not generic enough for others; I need to add a Z parameter." or "Hah! This class does not handle these corner cases quite right." In other words, the act of describing your class or method or parameter makes you think carefully about it and thus writing doc-comments leads to better code.

So much for theory; for some practical advice and guideline for Sandcastle and SHFB, take a look at my article on Simple-Talk.com entitled Taming Sandcastle: A .NET Programmer's Guide to Documenting Your Code. This article thoroughly documents all the things I found through research and experimentation with SHFB. Accompanying the article is a handy wallchart that brings together all the documented and the undocumented elements and attributes that you may use in doc-comments. Here's a fragment of the wallchart to whet your appetite:

Documentation from all comments in Visual Studio 2010 [closed]

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜