Platform | Architecture | Package Name | Version | Downloads |
---|---|---|---|---|
Windows | X86 | WebView2.Runtime.X86 | ||
Windows | X64 | WebView2.Runtime.X64 | ||
Windows | ARM64 | WebView2.Runtime.ARM64 | ||
Windows | Any | WebView2.Runtime.AutoInstaller |
- Install via nuget selected architecture package.
Install-Package WebView2.Runtime.X64
- Make sure what in you project appears folder WebView2 and all files marked as "Copy To Output".
- Initialize webview2 before usage, path must be to WebView2 directory. In most cases it must be in application directory.
var webView = new WebView2() { Dock = DockStyle.Fill };
await webView.EnsureCoreWebView2Async(await CoreWebView2Environment.CreateAsync(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "WebView2")));
Controls.Add(webView);
webView.CoreWebView2.Navigate("https://nuget.org/");
You can use package WebView2.Runtime.AutoInstaller to check current WebView2 runtime installed status and automate install it.
This type of installation requires running the program as an administrator (or installer will request them independently) and ethernet connection.
Source of this library you can find here.
- Install via nuget.
Install-Package WebView2.Runtime.AutoInstaller
- Use
// Check and install if not installed
await WebView2AutoInstaller.CheckAndInstallAsync();
// Only check, return true or false
await WebView2AutoInstaller.CheckAndInstallAsync(true);
// Show runtime installer window
await WebView2AutoInstaller.CheckAndInstallAsync(false, false);
// Set custom path to runtime installer (maybee you put it into application resources).
await WebView2AutoInstaller.CheckAndInstallAsync(false, false, "path");
You can found samples in Samples directory. Also check official microsoft edge samples repository.
- Clone repository.
- Run build.ps1 and wait.
- Or if you want to build with different WebView2 version download .cab files from fixed version section and put in build directory (as in picture) - https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section.
- nuget.exe - nuget package builder.
- expand.exe - tool for unpack .cab files (taked from windows 11 system32 directory).