在.NET XML code评论NET、XML、code

2023-09-03 13:55:32 作者:孤独是毒

你有多少用在code文件的XML注释,以及如何使用它们?我已经看到了,你可以用它们来生成XML文档,但这个XML文档可以用来生成HTML帮助文件或架构文件为您的code?

How much do you use the XML comments in your code files, and how do you use them? I've seen that you can use them to generate XML documentation, but can this XML documentation be used to generate an HTML help file or schema file for your code?

另外,你有没有使用任何自动生成评价工具(即GhostDoc),和你有什么即时通讯pressions?

Also, have you used any auto-generating comment tools (i.e. GhostDoc), and what are your impressions?

思考?

推荐答案

如果你从构建连同DLL文件分发XML文件本身的XML文档可以是有用的。这样一来,任何消费者的API有(通过智能感知或对象浏览器)可在IDE中有用的信息。

XML documentation by itself can be useful if you distribute the XML files from the build along with the DLLs. This way, any consumers of the API have useful information available from within the IDE (via Intellisense or the object browser).

现在也许最大使用XML注释是从这些建立XML文件的帮助文档的生成。 微软沙堡是要走的路的那一刻就这一点。它可以产生HTML帮助1(即CHM)文件或HTML帮助2(即帮助文件,可以集成到Visual Studio帮助)。 (注:在过去,NDoc的的选择可能看起来更具吸引力 - 有的人还用它 - 但沙堡似乎在这一刻正式和推荐的方法,特别是考虑到它是相当稳定和完善足以让几乎所有的目的。)请参见 SandcastleDocs 网站开始(这是非官方放在一起的开发商之一,在微软我相信)。特别是,你要检查出沙堡帮助文件生成器 GUI - 以我的经验,我发现这是一个很好的工具

Now perhaps the greatest use of XML comments is the generation of help documentation from these built XML files. Microsoft Sandcastle is the way to go regarding this at the moment. It can produce HTML Help 1 (i.e. CHM) files or HTML Help 2 (i.e. help files that can integrate into Visual Studio Help). (Note: In the past, the option of NDoc may have seemed more appealing - and some people still use it - but Sandcastle seems to be the official and recommended method at this moment, especially given that it's reasonably stable and complete enough for almost any purpose.) See the SandcastleDocs website to get started (this was unofficially put together by one of the developers at Microsoft I believe). In particular, you'll want to check out the Sandcastle Help File Builder GUI - in my experience I've found it to be an excellent tool.