Generate a. CHM help document for C # documentation comments

Source: Internet
Author: User

As a result of the recent need to write a document of a previous project, but do not know what is written, and just found a tool that can generate CHM, so I studied the next, feel good, so also to share under. OK, not much nonsense, let's implement it.

Pre-build preparation

Before you start, add a note: We generate the help document from the XML file generated by the C # documentation comment. Therefore, the first step is to generate an XML document:

Specific steps: Open vs-> create a project (here I use a console project), and then add the following:

<summary>//Human///</summary> public class Person {///       <summary> ///Name:///       </summary> public        string  name {get; set;}        <summary>///        </summary> public int: Age        {get; set;}        <summary>//        Self-introduction//</summary>//        <param name= "name" > Name </param> //        <param name= "Age" > Ages </param>//        <returns> self-introduced content </returns> public        String Say (String name,string age)        {            return ' My name is ' + name + ', Age: ' + age;        }    }

A very common class, but note the comment section, where the note is a document (different from the "//" comment, in vs "//" is the document comment)

PS: Note that my access modifier for the person class here is public, because I use only one class here, and if you do not add the public there will be "no APIs found to document." See error topic in Help file for details. " The error.

Before proceeding: Right-click the Assembly Selection property and select the XML document file:

Save, compile, and then in the project's bin\debug directory you will see the generated XML file:

Introduction to the Generating CHM documentation tool

Sandcastle is Microsoft's Official document generation tool, which seems to be the only tool in this area after NDoc development has stopped. It can generate complete help documents from DLL files and their XML comment files, supporting multiple generation formats (Helpe1x:chm, HELPER2X:HXS, Website,helperview), combined with the newly released sandcastle helps file Builder visualizer, the entire build process is very simple, and the SHFB tool looks very powerful, not only can directly configure the various properties of the generated document, but also support very flexible extension settings, to provide us with perfect. NET class Library document becomes a possibility.

Download the tool from here:

sandcastle:http://sandcastle.codeplex.com/, click on the right side of the download we all know.

Sandcastle Help File builder:http://shfb.codeplex.com/

I found a vs plugin in SHFB's compression package, so I'm going to use vs to demonstrate that if you don't want to install the plugin, you can run C:\Program Files (x86) \ewsoftware\sandcastle help File Builder \sandcastlebuildergui.exe This program, the results are the same

To generate a CHM document

Come on, open vs, New project:

Click OK, the project structure on the right:

Choose Contentlayout.content, look to the left, there are some document properties and version numbers and other information, but we do not use here, so delete. If it's okay to keep it, it's just a few more lines in the head when the document is generated, and interested friends can continue to study.

Select the assembly for which you want to generate the document (the corresponding XML is automatically added).

Right-click the project selection properties:

So far there is nothing but the wind. So where is the east wind? Very simple, build the project. If there is no error in the build process, you will see it under the Help folder in the project directory:

Open the test document:

Transferred from: http://www.cnblogs.com/fzrain/p/3604550.html

Generate a. CHM help document for C # documentation comments

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.