WebView2AppHost is a lightweight Windows desktop host for shipping HTML/CSS/JavaScript applications using WebView2.
It acts as a transparent host—meaning standard Web APIs just work. You don't have to learn custom wrapper APIs to manage windows, permissions, dialogs, or media.
It is designed for two primary audiences:
- Adopters: Package and ship web apps as desktop executables instantly, with zero host-side coding.
- Maintainers & Power Users: Extend capabilities dynamically using a MessageBus-centric connector architecture (Native DLLs, Sidecar processes, and AI/MCP integration).
Japanese README: README.ja.md
- 100% Standard Web APIs
window.close(),requestFullscreen(),beforeunload,navigator.permissions, and clipboard work exactly as they do in a standard browser.
- Zero-Rebuild Extension Model
- Need native capabilities? Drop a .NET DLL or a Node.js/Python/PowerShell script next to the EXE and enable it in
app.conf.json. No need to recompile the host application.
- Need native capabilities? Drop a .NET DLL or a Node.js/Python/PowerShell script next to the EXE and enable it in
- Built-in AI (MCP) Integration
- First-class Model Context Protocol (MCP) support. Expose your app's state, UI tools, or native capabilities to AI agents seamlessly (supports headless and proxy modes).
- Transparent CORS Proxy
- A built-in Chrome DevTools Protocol (CDP) proxy allows your local
https://app.localfrontend tofetch()external APIs without CORS errors.
- A built-in Chrome DevTools Protocol (CDP) proxy allows your local
- Ultra Lightweight & Portable
- Built on .NET 4.8 (pre-installed on modern Windows). No need to bundle a 100MB+ Chromium runtime.
If you simply want to wrap a web app as a desktop EXE:
- Get a prebuilt
WebView2AppHost.exe - Create a
www\folder next to the EXE and put your web files in it. - Add a
www\app.conf.jsonfile. - Run the EXE.
That's it. It runs as a fully functional Windows desktop application.
WebView2AppHost.exe
WebView2AppHost.exe.config
Microsoft.Web.WebView2.Core.dll
Microsoft.Web.WebView2.WinForms.dll
WebView2Loader.dll
www/
index.html
app.conf.json
assets/
scripts/
Minimal app.conf.json:
{
"title": "My App",
"window": { "width": 1280, "height": 720, "frame": true },
"url": "https://app.local/index.html",
"connectors": [
{ "type": "browser" }
]
}Tips: If end-users want to override the window size or fullscreen settings locally without modifying the core app config, they can simply place a
user.conf.jsonnext to the EXE.
The real power of WebView2AppHost is its extensibility without recompilation. If your app needs system-level capabilities, you just add Connectors.
dllConnector: Load a .NET DLL placed next to the EXE and call it directly from JavaScript (Perfect for Steamworks integrations).sidecarConnector: Spawn a Node.js, Python, PowerShell, or custom executable as a child process and communicate via JSON-RPC.pipe_server/mcpConnector: Allow local automation tools or AI agents (MCP clients) to connect to your app.
Extended Configuration Example:
{
"title": "My Extended App",
"window": { "width": 1280, "height": 720 },
"url": "https://app.local/index.html",
"connectors": [
{ "type": "browser" },
{ "type": "dll", "alias": "Steam", "path": "Facepunch.Steamworks.Win64.dll" },
{ "type": "sidecar", "alias": "PythonRuntime", "runtime": "python", "script": "tools/agent.py", "wait_for_ready": true }
]
}None of this requires rebuilding the host EXE.
The host can load web content from multiple sources based on your distribution needs. Priority is as follows:
- Appended ZIP:
copy /b EXE + ZIP. Best for single-file distribution. Enables "Security Protection Mode" to prevent external config overrides. - Command-line ZIP: Run
WebView2AppHost.exe patch.zip. Perfect for temporarily overriding loose files or using the EXE as a shell. www\next to the EXE: Best for large media files (video/audio).- Sibling ZIP:
WebView2AppHost.zip. Good for separating the executable from updatable content. - Embedded
app.zip: Built-in fallback resource.
See docs/guides/content-packaging.md.
If you need to build the host from source (e.g., to change the application icon or bake an embedded ZIP):
msbuild src\WebView2AppHost.csproj "/t:Restore;Build" /p:Configuration=Release /p:Platform=x64Build Configurations:
Debug: For local development. Copiestest-www\to the output directory.Release: Standard shipping build.SecureRelease: A restricted build that permanently strips out MCP, Sidecar, Pipe, and CDP code paths for high-security, offline-only applications.
Use the provided script to generate a clean distribution ZIP:
.\tools\package-release.ps1Check out the samples/ directory to see extensions in action immediately:
samples/sidecar-nodesamples/sidecar-pythonsamples/sidecar-powershellsamples/steam-complete(Native DLL integration using Facepunch.Steamworks)
Details regarding internal architecture, API compatibility, and the MessageBus bridge design are kept separate for developers: