使用SandCastle创建.Net帮助文档

引用自:http://www.cnblogs.com/DotNetNuke/archive/2009/04/23/1441899.html

Sandcastle是微软提供的一个根据XML注释和DLL文件生成帮助文件的工具,目前是在CodePlex上的一个开源项目,可以去这里下载:Sandcatle 项目
Sandcastle 本身是一个console的程序,为了方便使用,我们可以使用他的GUI版本:Sandcastle Help File Builder

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

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

using System;
 
using System.Collections.Generic;
 
using System.Text;
 
 
 
namespace ClassLibrary1
 
{
 
    /// <summary>
 
    /// A sample class to show something using Sandcastle
 
    /// </summary>
 
    public class SampleClass
 
    {
 
        private string _propertyValue;
 
 
 
        /// <summary>
 
        /// Gets or sets the property value.
 
        /// </summary>
 
        /// <value>The property value.</value>
 
        public string Property
 
        {
 
            get
 
            {
 
                return _propertyValue;
 
            }
 
            set
 
            {
 
                _propertyValue = value;
 
            }
 
        }
 
 
 
        /// <summary>
 
        /// Determines whether the property is null.
 
        /// </summary>
 
        /// <returns>
 
        ///     <c>true</c> if property is null; otherwise, <c>false</c>.
 
        /// </returns>
 
        public bool IsPropertyNull()
 
        {
 
            bool result = false;
 
 
 
            if (this.Property == null)
 
            {
 
                result = true;
 
            }
 
            return result;
 
        }
 
 
 
        /// <summary>
 
        /// Determines whether the property is null.
 
        /// </summary>
 
        /// <returns>
 
        ///     <c>true</c> if property is empty; otherwise, <c>false</c>.
 
        /// </returns>
 
        /// <example>
 
        /// This example shows how you might use this method:
 
        /// 
 
        /// <code>
 
        /// SampleClass sample = new SampleClass();
 
        /// 
 
        /// if (sample.IsPropertyEmpty())
 
        /// {
 
        ///        Console.WriteLine("The property is empty");
 
        /// }
 
        /// else
 
        /// {
 
        ///        Console.WriteLine("The property contains value " + sample.Property);
 
        /// }
 
        /// </code>
 
        /// </example>
 
        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来生成文档。

这是最终生成的文档:

使用SandCastle创建.Net帮助文档的更多相关文章

  1. Sandcastle入门:创建C#帮助文档

    Sandcastle入门:创建C#帮助文档 今天学到了一个东西:利用vs2005生成的dll/xml来生成帮助文档. 完成这个伟大任务的是Sandcastle,微软推出的类库文档编译工具. 在开始这篇 ...

  2. 转 创建 JavaScript XML 文档注释

    http://www.cnblogs.com/chenxizhang/archive/2009/07/12/1522058.html 如何:创建 JavaScript XML 文档注释 Visual ...

  3. [Swift通天遁地]七、数据与安全-(8)创建普通PDF文档和加密PDF文档

    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...

  4. MongoDB创建\更新\删除文档操作

     一.插入\创建文档 --当插入一个不存在的文档时,会自己主动创建一个文档 [root@racdb ~]# mongo MongoDB shell version: 2.4.14 connecti ...

  5. Elasticsearch 使用集群 - 创建和查询文档

    章节 Elasticsearch 基本概念 Elasticsearch 安装 Elasticsearch 使用集群 Elasticsearch 健康检查 Elasticsearch 列出索引 Elas ...

  6. 编写Java程序,使用 dom4j 创建一个 XML 文档,文档名为“city.xml”。注意该文档的格式和数据

    查看本章节 查看作业目录 需求说明: 使用 dom4j 创建一个 XML 文档,文档名为"city.xml".该文档的格式和数据如图所示 实现思路: 创建Java项目,添加dom4 ...

  7. 编写Java程序,创建一个 XML 文档,文档名为“hero.xml”,用于保存“王者荣耀”的英雄信息。

    查看本章节 查看作业目录 需求说明: 创建一个 XML 文档,文档名为"hero.xml",用于保存"王者荣耀"的英雄信息.英雄信息包括编号(id).姓名(na ...

  8. 使用 Sandcastle 生成代码帮助文档

    使用 Sandcastle可以生成MSDN风格的帮助文档,生成的帮助文档既可以是chm文档,也可以是MS Help 2.x帮助文档. 1 下载并安装Sandcastle Sandcastle下载地址为 ...

  9. 基于Picture Library创建的图片文档库中的上传多个文件功能(upload multiple files)报错怎么解决?

    复现过程 首先,我创建了一个基于Picture Library的图片文档库,名字是 Pic Lib 创建完毕后,我点击它的Upload 下拉菜单,点击Upload Picture按钮 在弹出的对话框中 ...

随机推荐

  1. Python之禅+八荣八耻

    Python之禅 (The Zen of Python):是Python语言的指导原则,可以在Python命令行输入import this显示. import this >>> Th ...

  2. Android成长日记-五大布局

    1. 五布局之线性布局LinearLayout 特点:它包含的子控件将以横向或竖向的方式排列 ps:android:gravity=”center|bottom”(gravity允许多级联用) Tip ...

  3. 加州大学伯克利分校Stat2.2x Probability 概率初步学习笔记: Section 2 Random sampling with and without replacement

    Stat2.2x Probability(概率)课程由加州大学伯克利分校(University of California, Berkeley)于2014年在edX平台讲授. PDF笔记下载(Acad ...

  4. Newton-Raphson算法简介及其R实现

    本文简要介绍了Newton-Raphson方法及其R语言实现并给出几道练习题供参考使用. 下载PDF格式文档(Academia.edu) Newton-Raphson Method Let $f(x) ...

  5. C++ Pitfalls 之 reference to an object in a dynamically allocated containter

    (留坑待填)  Extraction from the C++ Programming Language 4th. ed., Bjarne Stroustrup 31.3.3 Size and Cap ...

  6. 爬虫例子及知识点(scrapy知识点)

    新知识: 新建一个scrapy项目:scrapy startproject xxx(项目名称) 运行一个scrapy项目:scrapy crawl xxx(项目名称) 项目文件说明: 文件说明: • ...

  7. 超强语感训练文章(Provided by Rocky teacher Prince)

    Content: Class1 My name is Prince Class2 Welcome to our hotel Class3 We’re not afraid of problems Cl ...

  8. ubuntu --- shortcut key

    Linux系统下图形界面与Linux命令行模式的切换的方法 由图形转换到控制台模式:ctrl+alt+f1~f6(同时按下3秒钟不要马上松开)....由控制台转向图形模式是:alt+f7 快捷键(ub ...

  9. CentOS7搭建hadoop2.6.4+HBase1.1.6

    环境: CentOS7 hadoop2.6.4两个节点:master.slave1 HBase1.1.6 过程: hadoop安装目录:/usr/hadoop-2.6.4 master节点,hadoo ...

  10. wifi-mac

    //18:a6:f7:12:0b:8b //18:a6:f7:1e:a9:57 //18:a6:f7:1f:8e:69 //18:a6:f7:12:0b:9c //18:a6:f7:1f:cd:d4 ...