Automatically Building Your .chm File

Custom build rules in Visual C++ can build a .chm file anytime any of the sources to the .chm file change.

To add a custom build rule to build the latest version of the .chm

  1. Add the HTML Help Project file (.hhp) to a Visual C++ project. From the Project menu, click Add To Project, then choose Files options to access the Insert Files into Project dialog box.

  2. Select Settingsā€¦ from the Project menu to access the Project Settings dialog box.

  3. Select the .hhp file in the Settings For: list and click the Custom Build tab.

  4. The Commands entry for the build rule should resemble:

    hhc.exe $(InputName).hhp
    @echo off
    

    You may need to specify absolute or relative paths to the hhc.exe and .hhp file. You can put hhc.exe in your project's search path:

    • Select Optionsā€¦ from the Tools menu.

    • Click on the Directories tab and select Executable files from the Show directories for: list.

    • Specify the directory containing the hhc.exe file in the Directories list.

  5. The Outputs entry should resemble:

    $(InputName).chm
    

    You may have to specify an absolute or relative path to ensure that the output file is written to the desired location.

  6. If you want to rebuild the .chm file after a .htm file changes but where the .chm file wa not rebuilt, you should click the Dependencies... button in the Project Settings dialog box and specify each .htm file, including the path if necessary, to your HTML Help project.

Back to Help Topics (HTML Help)