如何通过固定版本分发模式分发我的WebView2 WPF应用程序



我想用固定版本的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子文件夹。

最新更新