I want to distribute my wpf app with fixed version WebView2, here is my XAML code:
XAML:
<wv2:WebView2 x:Name="webView" vm:ReceiverViewModel.PreviewData="{Binding MyData}">
<wv2:WebView2.CreationProperties>
<wv2:CoreWebView2CreationProperties>
<wv2:CoreWebView2CreationProperties.BrowserExecutableFolder>
Microsoft.WebView2.FixedVersionRuntime.87.0.664.8.x86\\EBWebView\\x86
</wv2:CoreWebView2CreationProperties.BrowserExecutableFolder>
</wv2:CoreWebView2CreationProperties>
</wv2:WebView2.CreationProperties>
</wv2:WebView2>
C#:
public Receiver()
{
InitializeComponent();
webView.Source = new Uri(System.IO.Directory.GetCurrentDirectory() + "/Receiver.html");
}
It doesn't work. Is BrowserExecutableFolder
set correctly?
BrowserExecutableFolder
should refer to the path of the Fixed Version binaries where you download from here and decompressed. You can also refer to this thread which points out that You must specify the environment before the WebView2 Source property takes effect. – Yu Zhou