问题描述
我想分发具有固定版本WebView2的wpf应用程序,这是我的XAML代码:
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");
}
它不起作用。 browserExecutableFolder
是否设置正确?
解决方法
对于固定版本部署,在提供browserExecutableFolder时,必须指定包含msedgewebview.exe的文件夹的路径。在上面,您可能希望指定Microsoft.WebView2.FixedVersionRuntime.87.0.664.8.x86
而不是EBWebView \ x86子文件夹。