ChmViewer is a Windows WPF application for viewing the contents of a .chm help file. It also provides basic search/navigation capabilities inside the CHM.
This repository contains both the application (app/) and the supporting CHM reading/viewing libraries (lib/).
Solution file: ChmViewer.sln
Projects:
-
app/ChmViewer(WPF Application)- Target:
net10.0-windows- Hosts the CefSharp-based WPF control
HtmlHelp.Wpf.Controls.ChmViewerControl. - Supports opening a CHM file using the built-in toolbar Open button.
- Supports opening a CHM file via command-line argument (pass a
.chmfile path). - Toolbar and status bar visibility can be controlled via
ChmViewerViewModel.ShowToolbarandChmViewerViewModel.ShowStatusBar.
- Hosts the CefSharp-based WPF control
- Target:
-
app/ChmViewerTest(WPF Application)- Target:
net10.0-windows - Demonstrates additional/legacy flows (library-based searching, optional CHM decompile + file search).
- Includes sample documents under
app/ChmViewerTest/Documents/.
- Target:
-
lib/HtmlHelp(Core CHM reader library)- Target:
net10.0 - Opens CHM content, reads index/TOC, and performs searches.
- Target:
-
lib/HtmlHelp.Wpf(WPF integration)- Target:
net10.0-windows- Provides
HtmlHelp.Wpf.Controls.ChmViewerControlandHtmlHelp.Wpf.Controls.ChmViewerViewModelfor embedding a CHM viewer in any WPF window.
- Provides
- Target:
-
lib/HtmlHelp.WinForms(WinForms integration)- Target:
net10.0-windows
- Target:
The main viewer experience is implemented by HtmlHelp.Wpf.Controls.ChmViewerControl:
- TOC on the left
- CefSharp Chromium browser on the right
- Optional toolbar (Back/Forward/Reload/Open)
- Optional status bar
The control is driven by HtmlHelp.Wpf.Controls.ChmViewerViewModel.
app/ChmViewerTest contains additional flows used for testing/demonstration, including:
- In-CHM keyword search using
lib/HtmlHelp. - Optional decompile-to-HTML flow using Windows
hh.exe.
Notes:
- The
hh.exeapproach only works on Windows. - You need write permissions to the target folder.
Packages used per project:
HtmlAgilityPack(1.11.24) – HTML parsing/processing.CefSharp.Wpf.NETCore(144.0.120) – Chromium-based WPF browser control.
SharpZipLib(1.4.2) – used for some content/stream operations.System.Resources.Extensions(10.0.2) – resource support.
CefSharp.Wpf.NETCore(144.0.120)chromiumembeddedframework.runtime.win-x64(144.0.12)chromiumembeddedframework.runtime.win-x86(144.0.12)
- Windows (required by WPF and
hh.exe)
The ChmViewer.sln header shows Visual Studio Version 18, so:
- You need a Visual Studio version that supports
.NET 10(often Preview). - Ensure the .NET Desktop Development workload is installed.
app/ChmViewer,lib/HtmlHelp.Wpf,lib/HtmlHelp.WinForms:net10.0-windowslib/HtmlHelp:net10.0
You need the .NET 10 SDK installed (may be Preview).
- Open
ChmViewer.sln. - Set
ChmVieweras the startup project. - Choose
x64(recommended) orx86. - Press
F5. - Select a
.chmfile using the toolbar Open button.
If you want to run the demo/test flows instead, set ChmViewerTest as the startup project.
From the repository root:
dotnet restoredotnet build ChmViewer.sln -c Release
delete-bin-obj-folders.bat: Removesbin/andobj/folders across all projects.
- CefSharp dependencies missing / not working: Ensure the selected platform (
x64/x86) matches the runtime packages. - CefSharp cache locked: Startup can fail if another process is already using the same cache directory (under
LocalAppData). - WPF
WebBrowserbehavior: TheWebBrowsercontrol depends on Windows/IE components; rendering behavior can vary by machine configuration.
app/ChmViewer/ChmViewer.csproj contains settings for single-file publish. When publishing with PublishSingleFile=true, the project is configured to use a dedicated StartupObject for CefSharp.