Implementing WebView2 Evergreen requires an understanding of how the runtime initializes and how to handle environments where the runtime might be missing. Runtime Detection and Installation
Always include the Evergreen WebView2 Runtime Bootstrapper in your application installer to handle machines that miss the runtime.
Implementing the Evergreen runtime requires two basic steps: verifying the runtime exists on the user's machine and initializing the control in your application code. Step 1: Runtime Verification and Installation
Evergreen WebView2 Runtime is a distribution mode for the Microsoft Edge WebView2 evergreen webview2
Be aware that the Evergreen mode, by design, does not allow you to specify a particular runtime version for your application. If your application requires strict version compatibility to function correctly (e.g., in a highly regulated industry or when embedded in specialized hardware), the Fixed Version distribution mode may be a more suitable choice.
At the heart of this ecosystem lies the . Understanding how the Evergreen distribution mode works is critical for any developer building robust, future-proof Windows applications. This article explores the architecture, benefits, deployment strategies, update mechanisms, and best practices for the Evergreen WebView2 Runtime.
using Microsoft.Web.WebView2.Core; public async void InitializeWebView() try // Passing null defaults the architecture to the Evergreen Runtime installed on the OS CoreWebView2Environment environment = await CoreWebView2Environment.CreateAsync(null, null, null); // Ensure the visual control is ready await webViewControl.EnsureCoreWebView2Async(environment); // Navigate to your application interface webViewControl.Source = new Uri("https://localhost:8080/app"); catch (WebView2RuntimeNotFoundException) // Fallback logic if the runtime is missing MessageBox.Show("The WebView2 Evergreen Runtime is required. Please install it to proceed."); Use code with caution. Summary: Future-Proofing Desktop Applications Understanding how the Evergreen distribution mode works is
| Feature | Evergreen | Fixed Version | |------------------------|------------------------------------|----------------------------------| | | Automatic (via Microsoft) | Manual (developer-controlled) | | App size overhead | None (shared runtime) | Large (runtime embedded) | | Security patches | Immediate (OS-level) | Developer must redistribute | | Chromium version | Latest stable (rolling) | Pinned at development time | | Network deployment | Simple (check for runtime presence)| Complex (include binaries) |
A common pain point for developers is handling the scenario where a user does not have the WebView2 Runtime installed.
These samples are available on Microsoft's official GitHub repository and serve as excellent starting points for integrating WebView2 runtime deployment into any installer technology [12†L10-L11]. static snapshot of the binaries
: The runtime receives the same security and feature updates as the Microsoft Edge Stable channel without requiring action from the developer.
To fully leverage the power of the Evergreen model, follow these best practices:
When deploying a WebView2 application, developers must choose between two distinct distribution models: and Evergreen . While Fixed Version locks your app to a specific, static snapshot of the binaries, the Evergreen distribution mode points your application to a globally shared, automatically updating runtime infrastructure.
When you release an app that uses WebView2, you must distribute the WebView2 Runtime to your client machines, choosing between two official distribution models: the and the Fixed Version distribution mode .