Agent skill
webview2-user-data-relocation
Keep WebView2 profile/cache data out of installed payload directories
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/webview2-user-data-relocation
SKILL.md
Context
Calling EnsureCoreWebView2Async() without an explicit environment lets WebView2 create App.exe.WebView2 beside the executable. That is fine for loose local runs, but it breaks MSI uninstall cleanliness because the install root is no longer immutable after first launch.
Pattern
Define a stable app-owned folder under %LOCALAPPDATA%, then bootstrap WebView2 with an explicit environment:
Directory.CreateDirectory(userDataFolder);
var environment = await CoreWebView2Environment.CreateAsync(userDataFolder: userDataFolder);
await webView.EnsureCoreWebView2Async(environment);
PanelNester Convention
- Put desktop mutable state behind
DesktopStoragePaths. - Current WebView2 profile path:
%LOCALAPPDATA%\PanelNester\WebView2\UserData - Keep MSI payload under
%LOCALAPPDATA%\Programs\PanelNesterstrictly for installed binaries and bundled web assets.
When To Apply
- Per-user MSI installs
- Any installer that must uninstall back to a clean install root
- Any desktop host where browser cache/profile data must stay separate from shipped files
Validation Checklist
- Install the MSI as a standard user.
- Launch once and wait long enough for WebView2 initialization.
- Confirm no
*.exe.WebView2folder appears beside the installed EXE. - Confirm the explicit
%LOCALAPPDATA%\AppName\...profile folder exists. - Uninstall and verify the install root is removed cleanly.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?