Sandcastle是微軟提供的一個根據XML注釋和DLL檔案產生協助檔案的工具

來源:互聯網
上載者:User

標籤:

      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是微軟提供的一個根據XML注釋和DLL檔案產生協助檔案的工具

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.