Home > OS >  Delphi, WebView2/TEdgeBrowser and the fixed runtime
Delphi, WebView2/TEdgeBrowser and the fixed runtime

Time:03-25

I have been working with TEdgeBrowser/WebView2 and an installed version of the Edge Beta/Canary browser version as the "runtime" which seems to work fine. However for production rollout we would greatly prefer to ship the fixed version of the runtime from within our application directory.

I have been attempting to use the following:

MyEdgeBrowser.BrowserExecutableFolder := ExtractFileDir(Application.ExeName)   '\WebView2Runtime';

Within the above referenced path I have the msedgewebview2.exe with the full installation of the fixed version runtime and all supporting files & folders. This is the file that I downloaded and extracted:

Microsoft.WebView2.FixedVersionRuntime.98.0.1108.62.x86.cab

Here's an image of what it looks like when extracted:

enter image description here

I have attempted to place the WebView2Loader.dll in my app directory, in the WebView2Runtime folder, and even in the WebView2Runtime\win-x86\native folder, always as a subfolder of my application directory.

I've tried the 11/20/2021 version of WebView2Loader.dll that Embarcadero distributes with the GetIt package manager, as well as the latest and greatest versions distributed by Microsoft via the NuGet package manager.

The CreateWebView call always fails.

Has anyone successfully got the fixed version runtime to work with Delphi & the WebView2Loader.dll? Are there version specific issues? What folder structure is required?

Thanks.

UPDATE: One crappy workaround that I found was to install a dev or canary version of Edge, then copy all of the files from the "C:\Program Files(x86)\Microsoft\Edge Beta" folder into my app folder, uninstall Edge Beta/Canary, then point the BrowserExecutableFolder to the "Edge Beta\Application<version #>" folder. This is the first time I've seen a "fixed version runtime" function without an Edge or Canary install.

CodePudding user response:

I had started the project in 64-bit mode but for internal reasons had to switch to 32-bit mode. Unfortunately I had not switched back to the 32-bit version of WebView2Loader.dll, but was using the 32-bit version of the runtime.

Once I switched to the 32-bit version of WebView2Loader.dll the TEdgeBrowser was able to work with just the fixed version runtime, no further installation required.

  • Related