Sandcastle入门:创建C#帮助文档
1. 名词解释:Sandcastle---------------------------------------[1]
2. Background---------------------------------------------------[1]
3. Sandcastle Overview-----------------------------------------[1]
4. 使用Sandcastle-----------------------------------------------[2]
4.1 使用平台
4.3 资源下载
5.0 使用命令行方式
5.1 Sandcastle Help File Builder
5.2 SandcastleGUI
5.3 Sandcastle CHM编译BAT脚本和配置实用工具
5.4 DocProject
6. References----------------------------------------------------[3]
========================================================================
========================================================================
|
4.使用Sandcastle
4.1使用平台
(1)操作系统:
Windows Server 2003; Windows XP Service Pack 2; Windows Vista;
(2)必备软件:
Microsoft .NET Framework Version 2.0
HTML Help Workshop——如果需要编译生成CHM文档(需要用到其中的hhc.exe文件)
(3)可选软件:
Visual Studio 2005
MS Help Compiler from VS SDK
4.2使用方式(可选界面)Ref[2]
(0)使用Sandcastle原始的命令行方式
(1)Sandcastle Help File Builder
它提供一个类似于NDoc的界面,允许你输入现有的NDoc项目,自动完成创建过程。
(2)SandcastleGUI
这是一个免费的Sandcastle GUI前端界面。利用它可以在图形界面操作,省去用户输入命令行的麻烦。并且具有以下扩充Ref[6]:
=============================================================================
>>自动在文档中插入MSDN文章链接
>>可以选择程序集中的某个命名空间生成文档,而不是默认的整个程序集
>>多种输出方式:网站、CHM帮助文件或输出二者
>>自定义帮助文档头部(公司LOGO以及产品名称等)
>>自定义帮助文章页脚(版权信息等)
>>在文档中插入自定义的图像
>>文档的代码实例中将C#语法高亮显示
=============================================================================
(3)Sandcastle CHM编译BAT脚本和配置实用工具
这是一个配置实用工具和批处理脚本,由它通过Sandcastle可建立MSDN形式的类文档CHM文件。
(4)DocProject
DocProject drives the Sandcastle help generation tools using the power of Visual Studio 2005/2008 and MSBuild.
4.3资源下载
[1]Sandcastle October 2007 CTP下载地址:(Update:version 2.3.8000.26,Released Date:2007-10-29)
http://www.microsoft.com/downloads/details.aspx?familyid=E82EA71D-DA89-42EE-A715-696E3A4873B2&displaylang=en
[2]HTML Help Workshop下载地址:(version1.4)
http://msdn2.microsoft.com/en-us/library/ms669985.aspx
[3]Sandcastle Help File Builder下载地址:(Update:version1.6.0.1,Released Date:2007-10-31)
http://www.codeplex.com/SHFB/Release/ProjectReleases.aspx?ReleaseId=7543
[4]SandcastleGUI下载地址:(Update:version1.40,Released Date:2007-11)
http://www.inchl.nl/SandcastleGUI/(瑶瑶按:这个需要登记邮箱,再从邮箱获取下载链接)
[5]DocProject下载地址:(version1.8.0,Released Date:2007-10-04,Update:version1.9.0 for October 2007 CTP will be available)
http://www.codeplex.com/DocProject/Release/ProjectReleases.aspx?ReleaseId=6652
——使用sandcastle自带的例子test.cs来生成CHM文件
==========================================================================
Note:7. We are providing VS 2005 transforms under Presentation/VS2005 folder and the transforms shipped with the previous versions under Presentation/Prototype folder.
For building VS2005 format please use sandcastle.config file from C:\Program Files\Sandcastle\Presentation\vs2005\Configuration folder as it uses shared content from C:\Program Files\Sandcastle\Presentation\vs2005\Content and transforms from C:\Program Files\Sandcastle\Presentation\vs2005\Transforms
==========================================================================
==========================================================================
1.首先要为项目生成一个包含注释的XML文件
在c#项目中鼠标右键点击所选的项目,选择Properties->Build项,勾选XML documentation file。设置完毕编译项目,就可以生成属于它的xml文件了。
2.打开我们已经安装好的Sandcastle Help File Builder并对它进行设置
>>点击Add按钮,选中项目生成的exe,dll,xml文件
>>保存该项目后点击Namespaces按钮,选中想要生成帮助文档的Namespace
>>设定Dependencies选项,把项目中所引用到的dll文件加载进去
>>设置HtmlHelp1xCompilerPath为HTML Help Workshop的安装路径,
>>设置SandcastlePath为Sandcastle的安装路径
3.点击顶头菜单Documentation下拉菜单中的Build Project选项(或直接使用快捷键Ctrl+Shift+B)编译即可生成所需的帮助文档
4.该文档的默认输出路径在项目所在目录的Help文件夹下,当然也可以更改Sandcastle Help File Builder中的设置,自己设定它的输入路径。==========================================================================
界面:
2)将*.dll和*.xml文件放在一个目录A下;将所有要附加的图片(比如类图和时序图)放在另一个并行的目录B下(注意不能有子文件夹);
3)启动SandcastleGUI,设置:
Directory that contains assemblies to document项选择目录A;
Output directory项选择一个空文件夹,如C;
Directory to include in documentation项选择目录B;
其它如C#语法、是否包含C#例子、生成文档类型(website或chm)等选项根据需要填。
4)设置完成后最好Save settings,因为可能常常要用到。然后Start documenting。
5)等待生成完成后就可以在C目录下找到chm文件了:
5.4 DocProject
——使用MSDN上包含有标准注释的XML文档生成帮助文件示例
==========================================================================
1 先编写一个类库,这里使用的是MSDN上包含有标准注释的"XML文档"示例
2 打开下载到的工程文件, 打开XMLsample.cs, 可以看到各种注释的详细解释
5.编译DocProject项目, 等待十几分钟(似乎有点慢, 即使类库很小), 就会在该项目下看到HTML版和CHM版的文档了。
==========================================================================
By Lex Mark(李杨),2006-11-12
http://tb.blog.csdn.net/TrackBack.aspx?PostId=1380172
builder.com.cn,2007-04-13
http://www.builder.com.cn/2007/0413/386855.shtml
英文原文:Create .NET documentation with Microsoft's Sandcastle
By Tony Patton,2007-04-10
http://articles.techrepublic.com.com/5100-3513-6174811.html
冬冬,2006-08-19
http://www.cnblogs.com/yuandong/archive/2006/08/19/481371.html
By MK2,2007-06-26
http://www.cnblogs.com/fengmk2/archive/2007/06/26/Create-your-classes-Library-doc-using-Sandcastle.html(未确定来源)
By justgarden,2006-12-23
http://blog.sina.com.cn/s/blog_4b756451010006n4.html(未确定来源)
By Dflying Chen,2006-11-13
http://www.cnblogs.com/dflying/archive/2006/11/13/558751.html
By aram,2006-07-29
https://blogs.msdn.com/sandcastle/archive/2006/07/29/682398.aspx
转自:http://hi.baidu.com/czlaner/blog/item/c4976d466db6370a6a63e56e.html