如何在 C#/VisualStudio 2008 中导出代码文档?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/51782/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 10:04:59  来源:igfitidea点击:

How do I export the code documentation in C# / VisualStudio 2008?

提问by Daren Thomas

I have always made a point of writing nice code comments for classes and methods with the C# xml syntax. I always expected to easily be able to export them later on.

我一直强调使用 C# xml 语法为类和方法编写漂亮的代码注释。我一直希望以后能够轻松地导出它们。

Today I actually have to do so, but am having trouble finding out how. Is there something I'm missing? I want to go Menu->Build->Build Code Documentation, but there is no option to do that, there.

今天我实际上必须这样做,但我很难找到方法。有什么我想念的吗?我想去Menu->Build->Build Code Documentation,但没有选择这样做。

采纳答案by Biri

Actually it's in the project properties. Build tab, Output section, XML documentation file, and enter the filename. It will be built on every build of the project.

实际上它在项目属性中。构建选项卡、输出部分、XML 文档文件,然后输入文件名。它将建立在项目的每个构建上。

After that you can build the actual help with Sandcastle.

之后,您可以使用Sandcastle构建实际帮助。

回答by Gulzar Nazim

You could try NDOCor SandCastleif you dont mind using 3rd party tools.

如果您不介意使用 3rd 方工具,您可以尝试NDOCSandCastle

回答by rjzii

Sandcastleworks pretty well for generating documentation and it supports a couple different formats for the generation. As far as I know, there isn't any Visual Studio integration for it, but there is a SandcastleGUIfor it that is available.

Sandcastle非常适合生成文档,并且支持几种不同的生成格式。据我所知,它没有任何 Visual Studio 集成,但有一个SandcastleGUI可用。

回答by NakedBrunch

Be careful if you're using LINQ to SQL as you won't be able to easily add sustainable comments to the auto-generated objects.

如果您使用 LINQ to SQL,请小心,因为您将无法轻松地向自动生成的对象添加可持续的注释。

回答by M4N

The original NDoc project (mentioned by others) is dead, but there is a new project called NDoc3.

原来的 NDoc 项目(其他人提到的)已经死了,但是有一个名为NDoc3的新项目。

NDoc3 supports .NET 2.0 - 3.5. It is currently available as a beta version and worked great for me. I'm not sure if the project is still active - the last beta was release in april 2009.

NDoc3 支持 .NET 2.0 - 3.5。它目前作为测试版提供,对我来说效果很好。我不确定该项目是否仍然有效 - 最后一个测试版是在 2009 年 4 月发布的。

回答by downwitch

Late comment, but worth adding that even though Sandcastle is mothballed, the Sandcastle Help File Builderremains in active development, and I found it very powerful and straightforward to dive into when dealing with just this situation--install to rich .chm and .html/.asp output in a couple hours.

迟到的评论,但值得补充的是,尽管 Sandcastle 已被封存,但Sandcastle 帮助文件生成器仍在积极开发中,我发现它在处理这种情况时非常强大且直接——安装到丰富的 .chm 和 .html /.asp 输出几个小时。

回答by Brent Matzelle

The previous answers are really out of date. Here are some more modern options:

以前的答案确实过时了。这里有一些更现代的选择:

  • DocFX: This is probably your best bet because it runs on Linux, macOS, and Windows and it's supported by the .NET Foundation.
  • Sandcastle Help File Builder (SHFB): This one is still supported but it might not be as active.
  • DocFX:这可能是您最好的选择,因为它可以在 Linux、macOS 和 Windows 上运行,并且得到 .NET Foundation 的支持。
  • Sandcastle 帮助文件生成器 (SHFB):仍然支持这个,但它可能没有那么活跃。