博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
使用SandCastle创建.Net帮助文档
阅读量:6947 次
发布时间:2019-06-27

本文共 2536 字,大约阅读时间需要 8 分钟。

Sandcastle是微软提供的一个根据XML注释和DLL文件生成帮助文件的工具,目前是在CodePlex上的一个开源项目,可以去这里下载:

Sandcastle 本身是一个console的程序,为了方便使用,我们可以使用他的GUI版本:

第一步,为你写的代码添加XML注释

我们创建一个简单的ClassLibrary1项目最为示范:

using System; using System.Collections.Generic; using System.Text;   namespace ClassLibrary1 {     ///      /// A sample class to show something using Sandcastle     ///      public class SampleClass     {         private string _propertyValue;           ///          /// Gets or sets the property value.         ///          /// 
The property value.
public string Property { get { return _propertyValue; } set { _propertyValue = value; } } /// /// Determines whether the property is null. /// ///
///
true
if property is null; otherwise,
false
. ///
public bool IsPropertyNull() { bool result = false; if (this.Property == null) { result = true; } return result; } /// /// Determines whether the property is null. /// ///
///
true
if property is empty; otherwise,
false
. ///
///
/// This example shows how you might use this method: /// ///
/// SampleClass sample = new SampleClass(); /// /// if (sample.IsPropertyEmpty()) /// { /// Console.WriteLine("The property is empty"); /// } /// else /// { /// Console.WriteLine("The property contains value " + sample.Property); /// } /// ///
public bool IsPropertyEmpty() { bool result = this.IsPropertyNull(); if (!result) { result = (Property.Trim().Length == 0); } return result; } } }

 

代码很简单,注意其中的XML注释。

打开项目的属性,在“Build”选项中,确保“XML documentation file:”被选中了。

第二步,编译这个项目,你会看到生成的DLL文件和XMl文件:

第三步,打开 Sandcastle Help File Builder

打开Sandcastle Help File Builder并新建一个项目:

为Sandcastle Help File Builder项目添加编译生成的DLL文件,右键点击项目右边的“Documentation Sources",选择“Add Documentation Source...”

选择刚刚生成的DLL文件。

第四步,修改设置

在项目的属性窗口,你可以根据需要修改一些设置。

第五步,生成文档

点击Build the help file来生成文档。

这是最终生成的文档:

 

出处:

转载地址:http://mfenl.baihongyu.com/

你可能感兴趣的文章
线性代数及其应用
查看>>
如何选择合适的数据库?
查看>>
Go:错误 could not launch process: EOF 解决
查看>>
CSS解决父子元素margin-top重叠问题
查看>>
redis消息队列简单应用
查看>>
android发送短信验证码并自动获取验证码填充文本框
查看>>
App 是否真的能检测手机壳颜色?
查看>>
学Hadoop还是Spark好?
查看>>
微服务生命周期的9个任务事项
查看>>
实战Kafka ACL机制
查看>>
云监控服务使用教程
查看>>
“旧城改造”的背后——银泰新零售阿里云解决方案(上)
查看>>
java B2B2C源码电子商务平台 -SpringCloud服务相互调用RestTemplate
查看>>
java B2B2C Springcloud电子商务平台源码-zuul 过滤器机制
查看>>
分布式消息系统:Kafka
查看>>
我的友情链接
查看>>
H3C防火墙路由器做回流
查看>>
Tableau10.5视频课程之常见图形制作
查看>>
Kettle5.4实战项目培训课程
查看>>
获取局域网里一个MAC地址对于的IP地址
查看>>