WebView2 working without WebView2 Runtime

Viewed 2079

we trying to use WebView2 without WebView2 Runtime (because of it´s 100 MB size and distributing it to clients).

It was tested on 2 PC´s. Both of them have same version of Edge. On PC1 WebView2 is not working whithout WV2 Runtime, on PC2 is working fine.

Do you have please any clue where can be a problem, why on PC1 is not WebView2 working? (PC1 is used for programming, PC2 no).

Thank you

2 Answers

You can use a fixed Version of WebView2 and by this make sure that your programm works on every PC even if they dont have the runtime installed.

Here you can download the fixed version you prefer:

https://developer.microsoft.com/de-de/microsoft-edge/webview2/

After you downloaded it you need to decompress the file into a folder of your choice. You can do this with the command-line command:

expand {path to the package} -F:* {path to the destination folder}

Now you should have a folder with an executable runtime for WebView2. With the following code you can say where the path of this "executable folder" is.

var webViewEnvironment = await Microsoft.Web.WebView2.Core.CoreWebView2Environment.CreateAsync("Path of the executable folder"), ("Path where you want the Cache to be saved")));
await webView2.EnsureCoreWebView2Async(webViewEnvironment);

With this you don't need to install the WebView2 Runtime

The runtime is required for WebView2 (with the special exception that insider builds of Edge will provide it). So the answer is that you cannot use WebView2 without the WebView2 Runtime.

Related