In the .NET 1.1 days, documentation could be generated easily and freely using nDoc. Understandably, the fact that it was free is partly why nDoc has now been discontinued.
Since nDoc doesn't support .NET 2.0, you'll need something else to make CHM and other help files for your new Visual Studio projects. That's where SandCastle, the documentation tool recently provided by Microsoft, comes into play. SandCastle is the new free .NET 2.0 documentation tool of choice (if not the only one), and there's a new Septmber 2006 CTP version out. SandCastle is heavily command-line driven, with many steps involved, which is not what I like to deal with when I need to make documentation. I'd rather automate it, which is where SandCastleBuilder (one of several tools that can automate SandCastle steps). Here's a quick walkthrough on how to use SandCastleBuilder and SandCastle to generate rich help files quickly and easily.
SandCastleBuilder can generate your help files as CHM files, HxS files, and/or as navigatable websites that look a little like MSDN's online documentation. If you only want to make a CHM or HxS file, you can skip this step. Otherwise, if you want to create a navigatable help website you'll need to fix a small SandCastle bug according to the SandCastleBuilder's documentation:
With the September 2006 CTP, when generating the help as a website, the resulting output will cause JavaScript errors when loaded in Internet Explorer. This is the result of a bug in one of the script files that tries to access a style sheet with an MS-Help format URL. Open up the Presentation\Prototypes\Scripts\StyleUtilities.js file in the SandCastle installation folder and change the getStyleDictionary() function to the following:
function getStyleDictionary() { var dictionary = new Array(); // iterate through stylesheets var sheets = document.styleSheets; for(var i=0; i<sheets.length;i++) { var sheet = sheets[i]; // It can't handle ms-help URLs if(sheet.href.substr(0, 8) == "ms-help:") continue; // get sheet rules var rules = sheet.cssRules; if (rules == null) rules = sheet.rules; // iterate through rules for(j=0; j<rules.length; j++) { var rule = rules[j]; // add rule to dictionary dictionary[rule.selectorText] = rule.style; } } return(dictionary); }
If you want to generate your help files automatically whenever you compile a new release version of your project, follow these instructions (from the SandCastleBuilder help):
Right click on the project name in the Solution Explorer, select Properties, and select the Build Events sub-item. Click in the Post-build Event Command Line option to enter the command line to run. You can click the Edit Post-build button to open a dialog with a larger editor and a list of available macros.
In a solution with multiple projects that are documented by the same help file builder project, the post-build event should be defined on the last project built by Visual Studio. If the projects are documented individually, you can place a post-build event on each one.
Below is an example of a common command line script that can be used (lines wrapped for display purposes). Replace the path to the tool with the path where you installed it on your PC, and specify the correct location of the SandCastleBuilder project file (.shfb). The IF statement prevents building the help file in debug builds where it may not be needed.
IF
IF "$(ConfigurationName)"=="Debug" Goto Exit"C:\Program Files\EWSoftware\Sandcastle Help File Builder\SandcastleBuilderConsole.exe" $(SolutionDir)Doc\TestProject.shfb:Exit
That's pretty much it. I'm sure later versions of SandCastle will feature more, but with the right helper tools it's pretty easy to get started.
Powered by: newtelligence dasBlog 2.0.7226.0
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2009, Ben Strackany
E-mail