2
votes

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?

1
You can refer to this doc about how to use Fixed Version distribution mode. The 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

1 Answers

3
votes

For Fixed Version deployment, when providing a browserExecutableFolder you must specify the path to the folder containing msedgewebview.exe. In the above you likely want to specify Microsoft.WebView2.FixedVersionRuntime.87.0.664.8.x86 not the EBWebView\x86 subfolder.