"Couldn't find a compatible Webview2 Runtime installation to host WebViews." Error

Description

The log shows this error:

--- 2023-03-10 13:44:07,223 [OUTLOOK] ERROR [HASH: BC3357B60ADE083554B5C1579713FD1D] ---
WebView2 initialization failed
Microsoft.Web.WebView2.Core.WebView2RuntimeNotFoundException: Couldn't find a compatible Webview2 Runtime installation to host WebViews. ---> System.IO.FileNotFoundException: Systém nemùže nalézt uvedený soubor. (Výjimka na základì hodnoty HRESULT: 0x80070002)
in Microsoft.Web.WebView2.Core.CoreWebView2Environment.<CreateAsync>d__3.MoveNext()
in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
in Microsoft.Web.WebView2.WinForms.WebView2.<InitCoreWebView2Async>d__18.MoveNext()
--- END TRACE ---

Or this error can be logged:

--- 2024-05-20 11:29:54,011 [OUTLOOK] ERROR [HASH: 3BBE121C4E34F8161142F63AB50662E2] ---
WebView2 initialization failed
System.IO.FileNotFoundException: Systém nemůže nalézt uvedený soubor. (Exception from HRESULT: 0x80070002)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at Microsoft.Web.WebView2.Core.CoreWebView2Environment.<CreateCoreWebView2ControllerAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.Web.WebView2.WinForms.WebView2.<InitCoreWebView2Async>d__26.MoveNext()
--- END TRACE ---

Version

All versions of eWay-CRM

Difficulty

Medium

Resolution

Windows 10 and newer

Install the WebView2 component. Alternatively, reinstall it.

If the WebView2 component is installed, the repair can resolve the issue.

Windows 7

Version 109 of Microsoft Edge and WebView2 is the last that supports Windows 7 - see https://blogs.windows.com/msedgedev/2022/12/09/microsoft-edge-and-webview2-ending-support-for-windows-7-and-windows-8-8-1/.

But Microsoft has an issue in Evergreen Bootstrapper, so you need to download and install this new file: https://download.eway-crm.com/tools/MicrosoftEdgeWebview2Setup_2.exe