4

xml代码注释生成.chm文档

 2 years ago
source link: https://www.mihu.live/archives/278/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

在Visual Studio中,在类和方法前面输入///会自动生成xml格式注释,只需要往节点里写对应的描述,关于更多的写法,参考
https://docs.microsoft.com/zh-cn/dotnet/csharp/programming-guide/xmldoc/recommended-tags-for-documentation-comments

生成xml注释文档

在Visual Studio中,点击 项目 —— 项目的属性 —— 生成 ,勾选 输出 中的 XML文档文件 ,重新编译,这样就会在对应的路径生成xml注释文档。
VS生成xml文档
生成的xml文档

安装Sandcastle Help File Builder和HTML HELP

Sandcastle Help File Builder下载地址:https://github.com/EWSoftware/SHFB
HTML HELP下载地址: http://web.archive.org/web/20160201063255/http://download.microsoft.com/download/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe
(来自https://docs.microsoft.com/en-us/answers/questions/265752/htmlhelp-workshop-download-for-chm-compiler-instal.html
下载Sandcastle Help File Builder时需要注意支持的vs版本,Help File Builder and Tools v2019.11.17.0是最后一个支持vs2015的版本
v2019.11.17.0是最后支持VS2015的版本

安装Sandcastle Help File Builder

弹出HTML HELP 1 Compiler是选择是,之后再安装HTML HELP1
跳过html help安装
接下来install shfb——install package,剩下的高兴装就装。

安装HTML HELP

网盘里这个就是上面的链接下载下来的
链接:https://pan.baidu.com/s/1JPMMUqf4NE5icChcoLoN5w
提取码:gyl7
安装完会提示已经有一个更新版本的,忽略即可。
安装html help

生成.chm文档

VS新建一个 Documentation 项目,右键点击 Documentation Sources ,将刚才bin目录下的.xml和.exe文件添加进来,然后双击 Project Properties ,选择语言,Framework版本。
ContentLayout.content会在chm文件中生成Welcome和VersionHistory,如果不想要可以删除。
Documentation属性设置
在Visibility中可以选择生成的文档中包括的方法,这个会解决生成的.chm文档只有public类和方法或者类和方法不全的问题。
在Path中选择HTML HELP路径,可以解决Could not find the path to the HTML Help 1 compiler. Is the HTML Help Workshop installed?的问题(安装HTML HELP时默认路径应该不会有这个问题),还可以设置另外的输出路径。
设置html help路径
其他的设置按实际情况。
最后右键项目名——生成,就会在help文件夹生成.chm文件

打开Sandcastle Help File Builder安装目录下的SandcastleBuilderGUI.exe,新建一个项目,其余的配置和方法一一致,最后点击cpu架构右边的生成按钮,就会在对应的目录里生成.chm文档。
SHFB添加文件及配置

参考:https://www.pianshen.com/article/91331392251/


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK