Integrate XML code comments into Visual Studio 2005/2008 using Sandcastle and HTML Help 2.0
Hi folks,
a few days ago I figured out how to create HTML help files from code comments and how
to integrate them into visual studio so pressing F1 on one of my classes opens the
generated help file.
Because I spent much time googleing the world getting all information I needed I decided
to write down how I did it:
1. Download and install tools
- Sandcastle Help File Builder
- HTML Help 2.0 compiler
The Help 2.0 compiler is integrated into the VS SDK (VS2005) (VC2008)
The compiler will be installed in the directory “%Program Files%\Common Files\Microsoft Shared\Help 2.0 Compiler\”.
Search for hxcomp.exe if you can’t locate it.
2. Configure Visual Studio to generate XML comment file
Open Project properties. Select Build tab and ensure that the checkbox “XML documentation file” is checked.
Then recompile your project.
3. Configure Sandcastle Help Builder
Create a new project and add your assembly to the project. Ensure that an xml file was found too. The added
entry should look like “MyAssembly.dll, MyAssembly.xml” and not like “MyAssembly.dll, Unknown.xml”. In this case
your xml documentation file was not found and a documentation cannot be build.
Lets go on with the settings:
Build > Help File Format: Enable HtmlHelp2x
Build > Dependencies: Add all assemblies your assembly depends on here.
Build > Framework Version: Select the .NET Framework version your assembly is build on.
Help File > Presentation Style: Select vs2005. This is not neccessary but pretty.
Paths > HtmlHelp2xCompilerPath: Give the path to the directory where hxcomp.exe is located.
Paths > SandcastpePath: Set it to the correct installed sandcastle path. In my case I had multiple versions
of sandcastle installed and had to specify where the newest version is installed.
4. Build help file
Now you should be able to build your help file. You cannot view Help 2 files without special viewers.
So build HTML Help 1.x files first until your output fits your needs. Play around with the
settings and define style, disable warning and define what you want to be documented.
Finally build a HTML help 2.0 file if your want to get it integrated into the Visual Studio
help system and go on with the next step.
5. Integrate help file into Visual Studio
Run Visual Studio.
Select File > New Project.
Select Other Project Types > Extensibility > Help Integration Wizard
In the first assistant step leave “Setup project” selected, chose your Visual Studio version and go next.
In the second assistant step add your Html Help 2 files (*.hxs).
Configure the last two steps as you wish.
Build the project.
Run the created setup which installes your help files into visual studio.
That’s it! Happy Easter!
Alexander

Great Article!
Everything worked as described!
Thanks so much!
Comment on March 25, 2008 @ 05:33:43
Great article.
Although, for me, HXCOMP.EXE was in the following location after installing 2005 SDK:
C:\Program Files\Visual Studio 2005 SDK\2007.02\VisualStudioIntegration\Archive\HelpIntegration
Cheers.
Comment on March 27, 2008 @ 14:49:36
A screenshot of what is going on would be nice!
Comment on June 25, 2008 @ 19:59:08
Thanks, Alexander. Your post made revisiting this topic after a year much more pleasant than I expected.
To support 1.x files, I also set HtmlHelp1xCompilerPath to the directory on my computer where hhc.exe is installed (C:\Program Files\HTML Help Workshop).
Cheers,
Joe
Comment on September 4, 2008 @ 00:52:14
What about a case where a help file is updated regularly? How can the tools be used to roll out an updated version of the help file?
Will rebuilding, and then re-running the setup, for instance, update the integrated help, or would these steps simply pile on more?
Thanks!
Comment on September 8, 2008 @ 22:11:32
Thank you.
Succint, to the point, and accurate.
Just what I needed.
It’s appreciated
Comment on September 11, 2008 @ 18:43:22
Hello,
I have a question.
At step 3, what king of new project do you create ?
Luiza
Comment on October 21, 2008 @ 11:33:20
Great post. Thanks!
I’ve been through all the steps and everything works (my help 2.0 file/topics show up in vs2008 help system) except hitting F1 on my class method in code window doesn’t take me to the topic. Have I missed something?
Michael
Comment on January 14, 2009 @ 22:18:23
Thanks!
That’s great summary what I found for the Sandcastle and help 2.0 integration.
BTW, do you have any idea how to plug-in my help to the other namesapce? Is it possible set any valuse in the Sandcastle?
Jessie
Comment on February 5, 2009 @ 10:03:49
Any word on how to get Sandcastle running on a build machine where you don’t want to install Visual Studio just so that you can install the MS Help 2.0 Compiler? I tried copying the C:\Program Files\Common Files\Microsoft Shared\Help 2.0 Compiler\ folder into my repository and point Sandcastle at that folder, but it fails with the following:
Compiling HTML Help 2.x file…
[C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe]
Build2xHelpFile:
Compiler could not load message resources. Terminating.
D:\Build\Contracts\Development\Integration\doc\Working\Build2xHelpFile.proj(62,5): error MSB6006: "HXCOMP.EXE" exited with code 3.
Last step completed in 00:00:00.5156
There are some rather old articles on decoupling the help compiler from VS2005, but nothing up-to-date for those building .NET 3.5 projects.
Comment on February 18, 2009 @ 03:59:39
Dear Sir,
I need to make a windows application help file. In VS 2003 we find the tools from start-all programs-VS Help Work Shop. But in VS 2005 how can I make the help file.
Thank you.
Comment on April 22, 2009 @ 12:14:48