Click here to Skip to main content
15,896,348 members
Articles / Operating Systems / Windows

Sandcastle Help File Builder

Rate me:
Please Sign up or sign in to vote.
4.93/5 (131 votes)
17 May 2007Ms-PL45 min read 1M   5.3K   291  
A GUI for creating projects to build help files with Sandcastle and a console mode tool to build them as well.
<configuration>
<dduetools>
    <builder>
      <components>

        <!-- Create skeleton document -->
        <component type="Microsoft.Ddue.Tools.CopyFromFileComponent" assembly="{@SandcastlePath}ProductionTools\BuildComponents.dll">
            <data file="{@PresentationPath}transforms\skeleton.xml" />
            <copy source="/*" target="/" />
        </component>

        <!-- Copy in reflection data -->
        <component type="Microsoft.Ddue.Tools.CopyFromIndexComponent" assembly="{@SandcastlePath}ProductionTools\BuildComponents.dll">
          <index name="reflection" value="/reflection/apis/api" key="@id" cache="10">
            <data files="reflection.xml" />
            <data files="{@SandcastlePath}Data\Cpref_reflection\*.xml" />
          </index>
          <copy name="reflection" source="*" target="/document/reference" />
        </component>

        <!-- Copy in container data -->
        <component type="Microsoft.Ddue.Tools.CopyFromIndexComponent" assembly="{@SandcastlePath}ProductionTools\BuildComponents.dll">
            <copy name="reflection" key="string(/document/reference/containers/namespace/@api)" source="*[not(local-name()='elements')]" target="/document/reference/containers/namespace" />
        </component>

        <component type="Microsoft.Ddue.Tools.ForEachComponent" assembly="{@SandcastlePath}ProductionTools\BuildComponents.dll">
          <variable expression="/document/reference/containers//type/@api" />
          <components>
            <component type="Microsoft.Ddue.Tools.CopyFromIndexComponent" assembly="{@SandcastlePath}ProductionTools\BuildComponents.dll">
              <copy name="reflection" source="apidata|templates|containers|attributes" target="/document/reference/containers//type[@api=$key]" />
            </component>
          </components>
        </component>

        <!-- Copy in parameter data -->
        <component type="Microsoft.Ddue.Tools.ForEachComponent" assembly="{@SandcastlePath}ProductionTools\BuildComponents.dll">
          <variable expression="/document/reference/parameters/parameter//type/@api" />
          <components>
            <component type="Microsoft.Ddue.Tools.CopyFromIndexComponent" assembly="{@SandcastlePath}ProductionTools\BuildComponents.dll">
              <copy name="reflection" source="apidata" target="/document/reference/parameters/parameter//type[boolean(@api=$key) and not(apidata)]" />
            </component>
          </components>
        </component>

        <!-- Generate syntax -->
        <component type="Microsoft.Ddue.Tools.IfThenComponent" assembly="{@SandcastlePath}ProductionTools\BuildComponents.dll">
          <if condition="not(starts-with($key,'Overload:') or starts-with($key,'R:'))" />
          <then>
            <component type="Microsoft.Ddue.Tools.SyntaxComponent" assembly="{@SandcastlePath}ProductionTools\BuildComponents.dll">
              <syntax input="/document/reference" output="/document/syntax" />
              <generators>
{@SyntaxFilters}
              </generators>
            </component>
          </then>
        </component>

        <!-- Copy in comments -->
        <component type="Microsoft.Ddue.Tools.CopyFromIndexComponent" assembly="{@SandcastlePath}ProductionTools\BuildComponents.dll">
          <index name="comments" value="/doc/members/member" key="@name" cache="100">
{@CommentFileList}
            <data files="%SystemRoot%\Microsoft.NET\Framework\v{@FrameworkVersion}\*.xml" />
          </index>
          <copy name="comments" source="*" target="/document/comments" />
        </component>

        <!-- Copy in reflection data and comments for members -->
        <component type="Microsoft.Ddue.Tools.ForEachComponent" assembly="{@SandcastlePath}ProductionTools\BuildComponents.dll">
          <variable expression="/document/reference/elements/element/@api" />
          <components>
            <component type="Microsoft.Ddue.Tools.IfThenComponent" assembly="{@SandcastlePath}ProductionTools\BuildComponents.dll">
              <if condition="not(/document/reference/elements/element[@api=$key]/*)" />
              <then>
                <component type="Microsoft.Ddue.Tools.CopyFromIndexComponent" assembly="{@SandcastlePath}ProductionTools\BuildComponents.dll">
                    <copy name="reflection" source="*[not(local-name()='elements')]" target="/document/reference/elements/element[@api=$key]" />
                </component>
              </then>
            </component>
            <component type="Microsoft.Ddue.Tools.CopyFromIndexComponent" assembly="{@SandcastlePath}ProductionTools\BuildComponents.dll">
              <copy name="comments" source="summary|overloads   " target="/document/reference/elements/element[@api=$key]" />
            </component>
          </components>
        </component>

        <!-- Copy in comments for the member's declaring type. -->
        <component type="Microsoft.Ddue.Tools.CopyFromIndexComponent" assembly="{@SandcastlePath}ProductionTools\BuildComponents.dll">
          <copy name="comments" key="string(/document/reference/containers/type/@api)" source="summary" target="/document/reference/containers" />
        </component>

        <!-- Show missing documentation component configuration.  This must
         appear before the TransformComponent. -->
        <component type="SandcastleBuilder.Components.ShowMissingComponent"
          assembly="{@SHFBFolder}SandcastleBuilder.Components.dll">
            <!-- All elements are optional. -->
            <!-- Auto-document constructors (true by default) -->
            <AutoDocumentConstructors value="{@AutoDocumentConstructors}" />

            <!-- Show missing param tags (true by default) -->
            <ShowMissingParams value="{@ShowMissingParams}" />

            <!-- Show missing remarks tags (false by default) -->
            <ShowMissingRemarks value="{@ShowMissingRemarks}" />

            <!-- Show missing returns tags (true by default) -->
            <ShowMissingReturns value="{@ShowMissingReturns}" />

            <!-- Show missing summary tags (true by default) -->
            <ShowMissingSummaries value="{@ShowMissingSummaries}" />

            <!-- Show missing value tags (false by default) -->
            <ShowMissingValues value="{@ShowMissingValues}" />
        </component>

        <!-- Version information component configuration.  This must appear
             before the TransformComponent.  See also: PostTransformComponent -->
        <component type="SandcastleBuilder.Components.VersionInfoComponent"
          assembly="{@SHFBFolder}SandcastleBuilder.Components.dll">
            <!-- Reflection information file for version info (required) -->
            <reflectionFile filename="reflection.xml" />
        </component>

        <!-- Code block component configuration.  This must appear before the
             TransformComponent.  See also: PostTransformComponent. -->
        <component type="SandcastleBuilder.Components.CodeBlockComponent"
          assembly="{@SHFBFolder}SandcastleBuilder.Components.dll"
          id="Code Block Component">
            <!-- Base path for relative filenames in source attributes (optional) -->
            <basePath value="{@ProjectFolder}" />

            <!-- Connect to language filter (optional).  If omitted,
                 language filtering is enabled by default. -->
            <languageFilter value="true" />

            <!-- Code colorizer options (required).
                 Attributes:
                    Language syntax configuration file (required)
                    XSLT style file (required)
                    "Copy" image file URL (required)
                    Default language (optional)
                    Enable line numbering (optional)
                    Enable outlining (optional)
                    Tab size override (optional, 0 = Use syntax file setting)
                    Use language name as default title (optional) -->
            <colorizer syntaxFile="{@SHFBFolder}Colorizer\highlight.xml"
                styleFile="{@SHFBFolder}Colorizer\highlight.xsl"
                copyImageUrl="../icons/CopyCode.gif"
                language="cs" numberLines="false" outlining="false"
                tabSize="0" defaultTitle="true" />
        </component>

        <!-- transform -->
        <component type="Microsoft.Ddue.Tools.TransformComponent" assembly="{@SandcastlePath}ProductionTools\BuildComponents.dll">
          <transform file="{@PresentationPath}transforms\main_sandcastle.xsl">
            <argument key="metadata" value="true" />
            <argument key="languages">
{@SyntaxFiltersDropDown}
            </argument>
          </transform>
        </component>

        <!-- Post-transform component configuration.  This must appear after the
             TransformComponent.  See also: CodeBlockComponent. -->
        <component type="SandcastleBuilder.Components.PostTransformComponent"
          assembly="{@SHFBFolder}SandcastleBuilder.Components.dll"
          id="Post-transform Component">
            <!-- Code colorizer files (required).
                 Attributes:
                    Stylesheet file (required)
                    Script file (required)
                    "Copy" image file (required) -->
            <colorizer stylesheet="{@SHFBFolder}Colorizer\highlight.css"
                scriptFile="{@SHFBFolder}Colorizer\highlight.js"
                copyImage="{@SHFBFolder}Colorizer\CopyCode.gif" />

            <!-- Output path for the files (required).  This should match the
                 output path of the HTML files (see SaveComponent below). -->
            <outputPath value="Output\html" />

            <!-- Logo image file (optional).  Filename is required. The height,
                 width, altText, placement, and alignment attributes are
                 optional. -->
            <logoFile filename="" height="0" width="0" altText=""
                placement="left" alignment="left" />
        </component>

        <!-- resolve shared content -->
        <component type="Microsoft.Ddue.Tools.SharedContentComponent" assembly="{@SandcastlePath}ProductionTools\BuildComponents.dll">
            <content file="shared_content.xml" />
            <content file="reference_content.xml" />
            <content file="syntax_content.xml" />
        </component>

        <!-- Resolve links to internal and external help topics -->
        <component type="Microsoft.Ddue.Tools.ResolveReferenceLinksComponent"
          assembly="{@SandcastlePath}ProductionTools\BuildComponents.dll"
          locale="{@Locale}">
            <targets files="reflection.xml" type="{@ProjectLinks}" />
            <targets files="{@SandcastlePath}Data\Cpref_reflection\*.xml" type="{@SDKLinks}" />
        </component>

        <!-- save the result -->
        <component type="Microsoft.Ddue.Tools.SaveComponent" assembly="{@SandcastlePath}ProductionTools\BuildComponents.dll">
            <save base="Output\html" path="concat(/html/head/meta[@name='guid']/@content,'.htm')" indent="false" omit-xml-declaration="true" />
        </component>

      </components>
    </builder>
  </dduetools>
</configuration>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Software Developer (Senior)
United States United States
Eric Woodruff is an Analyst/Programmer for Spokane County, Washington where he helps develop and support various applications, mainly criminal justice systems, using Windows Forms (C#) and SQL Server as well as some ASP.NET applications.

He is also the author of various open source projects for .NET including:

The Sandcastle Help File Builder - A front end and project management system that lets you build help file projects using Microsoft's Sandcastle documentation tools. It includes a standalone GUI and a package for Visual Studio integration.

Visual Studio Spell Checker - A Visual Studio editor extension that checks the spelling of comments, strings, and plain text as you type or interactively with a tool window. This can be installed via the Visual Studio Gallery.

Image Map Controls - Windows Forms and web server controls that implement image maps.

PDI Library - A complete set of classes that let you have access to all objects, properties, parameter types, and data types as defined by the vCard (RFC 2426), vCalendar, and iCalendar (RFC 2445) specifications. A recurrence engine is also provided that allows you to easily and reliably calculate occurrence dates and times for even the most complex recurrence patterns.

Windows Forms List Controls - A set of extended .NET Windows Forms list controls. The controls include an auto-complete combo box, a multi-column combo box, a user control dropdown combo box, a radio button list, a check box list, a data navigator control, and a data list control (similar in nature to a continuous details section in Microsoft Access or the DataRepeater from VB6).

For more information see http://www.EWoodruff.us

Comments and Discussions