-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Labels
bugSomething isn't workingSomething isn't workingtrackedWe are tracking this work internally.We are tracking this work internally.
Description
This is how I run time installer that gets downloaded if required. I followed the official guidelines:
if (bWebView2RuntimeNeeded) then
begin
if Exec(ExpandConstant(strWebView2RuntimePath), '/silent /install', '',
SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin
{ Handle success if necessary; ResultCode contains the exit code }
Log('WebView2Runtime installer exit code = ' + IntToStr(ResultCode));
if ResultCode = 3010 then
begin
Log('Need restart');
bNeedsRestart := True;
end
else
if ResultCode <> 0 then
begin
MsgBox(
ExpandConstant('{cm:InstallFailed,WebView2 Runtime}'),
mbInformation, MB_OK);
Abort();
end;
end
else begin
{ The execution failed for some reason }
Log('WebView2 Runtime installer exit code = ' + IntToStr(ResultCode));
MsgBox(SysErrorMessage(ResultCode), mbInformation, MB_OK);
Abort();
end;
end;
The if test there is from my existing code for the Visual Studio Runtime.
- Does the Webview2Runtime have return error codes?
- Does a specific code indicate if a restart is needed?
This is the URL I download from:
strWebView2RuntimeURL = 'https://go.microsoft.com/fwlink/p/?LinkId=2124703';
Also, this is how I currently test if the runtime is installed:
function IsWebView2RuntimeNeeded(): boolean;
var
Version: string;
RuntimeNeeded: boolean;
VerifyRuntime: boolean;
begin
{ See: https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#detect-if-a-suitable-webview2-runtime-is-already-installed }
RuntimeNeeded := true;
VerifyRuntime := false;
{ Since we are using an elevated installer I am not checking HKCU }
if (IsWin64) then
begin
{ Test x64 }
if (RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}', 'pv', Version)) then
begin
{ We need to verify }
VerifyRuntime := true;
end
else
begin
{ Test x32 }
if (RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}', 'pv', Version)) then
begin
{ We need to verify }
VerifyRuntime := true;
end;
end;
{ Verify the version information }
if (VerifyRuntime) then
begin
if (Version <> '') and (Version <> '0.0.0.0') then
begin
Log('WebView2 Runtime is installed');
RuntimeNeeded := false;
end
else
Log('WebView2 Runtime needs to be downloaded and installed');
end;
end;
Result := RuntimeNeeded;
end;
Do I need to actually ensure that the version number is greater than or equal to the version that I am using when compiling the project?
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingtrackedWe are tracking this work internally.We are tracking this work internally.