Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow fixed version of WebView2 on Windows #202

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Microsoft.Web.WebView2.Core;
using Microsoft.Web.WebView2.Wpf;
using System;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows.Controls;
using Xamarin.Forms.Platform.WPF;
Expand Down Expand Up @@ -61,7 +63,9 @@ private async Task HandleElementChangedAsync(ElementChangedEventArgs<WebViewExte
e.NewElement.RetainedNativeControl = nativeControl;
SetNativeControl(nativeControl);

_coreWebView2Environment = await CoreWebView2Environment.CreateAsync().ConfigureAwait(true);
var defaultPrivateWebView2InstallFolder = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "WebView2");
var privateWebView2InstallFolder = Directory.Exists(defaultPrivateWebView2InstallFolder) ? defaultPrivateWebView2InstallFolder : null;
_coreWebView2Environment = await CoreWebView2Environment.CreateAsync(privateWebView2InstallFolder).ConfigureAwait(true);

await nativeControl.EnsureCoreWebView2Async(_coreWebView2Environment).ConfigureAwait(true);

Expand Down