webview2-user-data-relocation

Relocate WebView2 user data to a LOCALAPPDATA folder for immutable installs.

Updated Mar 16, 2026
One-click install
npx skills add https://github.com/BSchafer01/PanelNester --skill webview2-user-data-relocation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: webview2-user-data-relocation
Source: https://github.com/BSchafer01/PanelNester/tree/main/.squad/skills/webview2-user-data-relocation
Command: npx skills add https://github.com/BSchafer01/PanelNester --skill webview2-user-data-relocation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

WebView2 profiles and caches can live next to the installed binaries, which complicates MSI uninstall and leaves the install root mutable. This Skill relocates WebView2 user data to a dedicated app-owned folder under LOCALAPPDATA to keep the installed payload clean and maintainable.

Core Features & Use Cases

  • Create a stable app-owned folder under %LOCALAPPDATA% for WebView2 User Data (profile and cache).
  • Bootstrap WebView2 with an explicit environment via CoreWebView2Environment.CreateAsync(userDataFolder: ...).
  • Launch WebView2 using the explicit environment to prevent stray App.exe.WebView2 folders beside the executable.
  • Improve MSI uninstall cleanliness and per-user install integrity by isolating runtime data.

Quick Start

Configure your app to create a LOCALAPPDATA userDataFolder and initialize CoreWebView2Environment with that path, then call EnsureCoreWebView2Async using the created environment.

Frequently Asked Questions about webview2-user-data-relocation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I keep WebView2 user data out of my application's install folder?

To keep WebView2 user data out of the install folder, relocate the profile and cache to a dedicated app-owned folder under %LOCALAPPDATA%. This maintains an immutable install root and improves MSI uninstall cleanliness.

How do I configure CoreWebView2Environment to use a custom userDataFolder?

Configure CoreWebView2Environment by calling CreateAsync with an explicit userDataFolder path. You then initialize the WebView2 control using EnsureCoreWebView2Async with this created environment to bootstrap the runtime.

Why does WebView2 create an App.exe.WebView2 folder next to my executable?

WebView2 creates an App.exe.WebView2 folder beside your executable when launched without an explicit environment. Providing a LOCALAPPDATA-based path via CoreWebView2Environment.CreateAsync prevents these stray directories.

What is the best way to ensure clean MSI uninstall for WebView2 desktop apps?

The best way to ensure clean MSI uninstall is isolating runtime data from installed binaries. Relocating WebView2 user data to a stable LOCALAPPDATA folder keeps the installed payload clean and maintains per-user install integrity.

Does this WebView2 relocation approach work for per-user Windows desktop installations?

Yes, this relocation approach works for per-user Windows desktop installs. It targets Windows desktop hosts using WebView2, applying a stable LOCALAPPDATA storage path to handle per-user installs and clean uninstall scenarios.