Sandcastle is a documentation generator from Microsoft. It automatically produces MSDN-style code documentation out of reflection information of .NET assemblies and XML documentation comments found in the source code of these assemblies. It can also be used to produce user documentation from Microsoft Assistance Markup Language (MAML) with the same look and feel as reference documentation.
Overview Sandcastle is a set of command line programs, configuration files, build components and XSLT files that work together to convert XML-based documentation into help topics that are fit for viewing in a help system. Sandcastle is typically used to automatically generate web-ready, XML-compliant HTML documentation in one of three built-in presentation styles from .NET assemblies and XML documentation files that are generated by compilers. The resulting HTML files are then used as input to tools such as the HTML Help Workshop to produce compiled help for distribution with the corresponding computer program. Sandcastle currently features a lightweight graphical user interface (GUI) as an alternative to the MSBuild project, batch script and Windows PowerShell scripts that are also provided. Several community GUI tools are also available for Sandcastle, providing additional features and simplifying its usage. The Visual Studio SDKs for 2005 and 2008 include older CTP versions of Sandcastle, although the latest release is available on GitHub.
Sandcastle tools Sandcastle consists of several programs, not all of which are used in the typical help build process. Commonly used tools are listed below.
MrefBuilder uses Common Compiler Infrastructure (CCI) to reflect against managed assemblies and generate an output file. XslTransform applies XSL transformations to an XML file. Typically, the specified input file is or derives from a file that is generated by MRefBuilder. BuildAssembler executes a build component stack, once for each topic defined in an XML manifest. A build component stack is defined in an XML file with a .config extension. Sandcastle provides several build components that are used in build component stacks to perform tasks such as generating in-memory data indexes, resolving links, including shared content, executing XSL transformations and saving the final output to a file.
Community tools Because in its current state Sandcastle by itself is rather complex to use, people have come up with tools and scripts that can automate the task for them. This section contains a list of such tools and scripts.
Sandcastle Help File Builder DocProject (Visual Studio 2005/2008) Batch file PowerShell script MSBuild script Archived 2011-12-17 at the Wayback Machine Sandcastle Visual Studio Add-In XML Schema Documenter for Sandcastle Help File Builder Archived 2009-03-06 at the Wayback Machine
Output Sandcastle produces XML-based HTML files in a chosen presentation style. (This does not mean, however, that the files are XHTML-compliant.) The HTML is defined by XSL transformation files that are included in the particular presentation style being used. A build normally uses only one presentation style at a time. The HTML files that Sandcastle produces are either conceptual (user) documentation, being the result of a transformation from Microsoft Assistance Markup Language (MAML) topics, or they are reference documentation, which is automatically generated from reflection data and XML documentation comments. These two different types of HTML output share the same presentation style and may be compiled together to produce mixed user/reference documentation. The processes for building conceptual documentation and reference documentation are similar, with one of the main differences being that conceptual documentation does not require the MRefBuilder program to be used. Conceptual documentation consists of topics written using a MAML document type schema such as how to, walk-through, troubleshooting and several others. Sandcastle provides a conceptual build component stack (conceptual.config) that resolves shared content and links, and uses XSL files to transform MAML elements into HTML. Reference documentation is generated automatically for managed Application Programming Interfaces (APIs) from reflection data and XML documentation comments. A "doc model" XSL transformation, provided by the chosen presentation style, is applied to define the files that will be generated. Sandcastle provides a reference build component stack (sandcastle.config) that builds in-memory indexes of the data, resolves shared content and links, and uses XSL to generate the final HTML output.
Compiled help Sandcastle does not produce compiled help output itself (although, the HTML files that it produces can be used as input to HTML help compilers such as the HTML Help Workshop and Microsoft Help 2). For example, the typical Help 1.x build process starts by running MrefBuilder.exe to produce an XML reflection file for one or more assemblies. The reflection file is then processed by the XslTransform.exe tool multiple times to apply various XSL transformations that add data such as a "doc model" and optional version information. Next, an XML-based topic manifest is generated and used by the BuildAssembler.exe program, which generates HTML topic files from the reflection data and XML documentation comments. An XML-based table of contents (TOC) file is generated and used by CHMBuilder.exe, along with the HTML files produced by BuildAssembler, to generate HTML Help Workshop project, index and TOC files. Finally, the HTML Help workshop is used to generate a compiled help file (.chm). Some tools are used multiple times during a single build, like XslTransform and BuildAssembler. Depending upon the requirements, other tools and XSL transformations may be used at various stages during the process to modify Sandcastle's output.
… excerpt ends here. Continue reading the full article.