#43 Unable to find the HTML Help Compiler on x64

open
nobody
5
2010-10-27
2010-10-27
Piotr Fusik
No

I get the "Unable to find the HTML Help Compiler" exception on 64-bit Windows 7 with Visual Studio 2010 Ultimate.
A workaround is to copy the "HTML Help Workshop" directory from "C:\Program Files (x86)" to "C:\Program Files".

Discussion

  • One way to fix the problem would be to use the accepted answer in:
    http://stackoverflow.com/questions/194157/c-how-to-get-program-files-x86-on-vista-x64
    to fetch the program files folder instead of using Environment.SpecialFolder.ProgramFiles.

    Remember that the following files need to be changed:
    - src\Documenter\Msdn\HtmlHelp.cs
    - src\Documenter\Msdn\HtmlHelp.cs
    and maybe the following
    - src\Documenter\NativeHtmlHelp2\Compiler\HxObject.cs

     
  • Here is a patch that fixes this issue on Windows 7 64 bits. I did *not* test on a 32 bits OS. Id did not find a way to attach a file so here it is in the comment.
    Index: src/Core/Core/PathUtilities.cs
    ===================================================================
    --- src/Core/Core/PathUtilities.cs (revision 369)
    +++ src/Core/Core/PathUtilities.cs (working copy)
    @@ -260,5 +260,35 @@
    }
    return path;
    }
    +
    + /// <summary>Returns the folder containing 32-bit programs:
    + /// <list type="table">
    + /// <listheader>
    + /// <term>Platform</term>
    + /// <description>Returned Value</description>
    + /// </listheader>
    + /// <item>
    + /// <term>32 bit Windows</term>
    + /// <description>C:\Program Files</description>
    + /// </item>
    + /// <item>
    + /// <term>32 bit program running on 64 bit Windows</term>
    + /// <description>C:\Program Files (x86)</description>
    + /// </item>
    + /// <item>
    + /// <term>64 bit program running on 64 bit Windows</term>
    + /// <description>C:\Program Files (x86)</description>
    + /// </item>
    + ///</list>
    + ///</summary>
    + public static string GetProgramFilesx86Folder()
    + {
    + if (8 == IntPtr.Size
    + || (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"))))
    + {
    + return Environment.GetEnvironmentVariable("ProgramFiles(x86)");
    + }
    + return Environment.GetEnvironmentVariable("ProgramFiles");
    + }
    }
    }
    Index: src/Documenter/Msdn2/HtmlHelp.cs
    ===================================================================
    --- src/Documenter/Msdn2/HtmlHelp.cs (revision 369)
    +++ src/Documenter/Msdn2/HtmlHelp.cs (working copy)
    @@ -124,10 +124,8 @@
    }

    //try the default Html Help Workshop installation directory
    - _htmlHelpCompiler = Path.Combine(
    - Environment.GetFolderPath(
    - Environment.SpecialFolder.ProgramFiles),
    - @"HTML Help Workshop\hhc.exe");
    + _htmlHelpCompiler = Path.Combine(PathUtilities.GetProgramFilesx86Folder(),
    + @"HTML Help Workshop\hhc.exe");
    if (File.Exists(_htmlHelpCompiler)) {
    return _htmlHelpCompiler;
    }
    Index: src/Documenter/Msdn/HtmlHelp.cs
    ===================================================================
    --- src/Documenter/Msdn/HtmlHelp.cs (revision 369)
    +++ src/Documenter/Msdn/HtmlHelp.cs (working copy)
    @@ -145,10 +145,8 @@
    }

    //try the default Html Help Workshop installation directory
    - _htmlHelpCompiler = Path.Combine(
    - Environment.GetFolderPath(
    - Environment.SpecialFolder.ProgramFiles),
    - @"HTML Help Workshop\hhc.exe");
    + _htmlHelpCompiler = Path.Combine(PathUtilities.GetProgramFilesx86Folder(),
    + @"HTML Help Workshop\hhc.exe");
    if (File.Exists(_htmlHelpCompiler)) {
    return _htmlHelpCompiler;
    }

     
  • foens
    foens
    2011-10-26

    Still getting this bug after nearly a year now.