In my CurStepChanged
我有一些安装 Visual Studio Redistributable 的代码(如果需要)。代码片段:
if (bVcRedist64BitNeeded) then
begin
if Exec(ExpandConstant(vcRedist64BitPath), '/install /passive /norestart', '',
SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin
{ handle success if necessary; ResultCode contains the exit code }
Log('VS Redist (64 bit) installer exit code = ' + IntToStr(ResultCode));
if not (ResultCode = 0) then begin
MsgBox(ExpandConstant('{cm:InstallFailed,Visual Studio x64 Redistributable}'), mbInformation, MB_OK);
Abort();
end;
end
else begin
{ The execution failed for some reason }
Log('VS Redist (64 bit) installer exit code = ' + IntToStr(ResultCode));
MsgBox(SysErrorMessage(ResultCode), mbInformation, MB_OK);
Abort();
end;
end;
我有一位用户说我的软件安装程序失败,所以我要求他们向我发送他们的日志。在所有日志的末尾,它与此类似:
2020-09-05 14:37:48.034 VS Redist (64 bit) installer exit code = 3010
2020-09-05 14:37:48.035 Message box (OK):
The installation of Visual Studio x64 Redistributable failed. The Meeting Schedule Assistant installation will be aborted.
2020-09-05 14:38:38.352 User chose OK.
2020-09-05 14:38:38.352 CurStepChanged raised an exception.
2020-09-05 14:38:38.353 Need to restart Windows? No
2020-09-05 14:38:38.373 Exception message:
2020-09-05 14:38:38.374 Message box (OK):
Internal error: Expression error 'Runtime error (at 191:1960):
Exception: Operation aborted.'
2020-09-05 14:38:40.747 User chose OK.
2020-09-05 14:38:40.747 Exception message:
2020-09-05 14:38:40.747 Message box (OK):
Internal error: Expression error 'Runtime error (at 191:1960):
Exception: Operation aborted.'
2020-09-05 14:38:42.082 User chose OK.
2020-09-05 14:38:42.103 Exception message:
2020-09-05 14:38:42.104 Message box (OK):
Out Of Range.
2020-09-05 14:38:44.052 User chose OK.
2020-09-05 14:38:51.259 -- Run entry --
2020-09-05 14:38:51.259 Run as: Original user
2020-09-05 14:38:51.259 Type: Exec
2020-09-05 14:38:51.260 Filename: C:\Program Files (x86)\Meeting Schedule Assistant\MeetSchedAssist.exe
我注意到 redist 设置正在退出,结果是3010
。我找不到任何有关 redist 退出代码的官方文档,但它似乎是软重启。不管怎样,今天他们尝试了我的安装程序,它成功了(因为他们昨晚更换了电脑):
2020-09-06 13:08:38.707 VS Redist (64 bit) installer exit code = 0
2020-09-06 13:09:33.070 VS Redist (32 bit) installer exit code = 0
2020-09-06 13:09:33.071 Need to restart Windows? No
2020-09-06 13:10:07.741 -- Run entry --
2020-09-06 13:10:07.741 Run as: Original user
2020-09-06 13:10:07.741 Type: Exec
2020-09-06 13:10:07.741 Filename: C:\Program Files (x86)\Meeting Schedule Assistant\MeetSchedAssist.exe
所以我假设 3010 确实意味着软重启?如果是这样,我们在 Inno Setup 安装中是否有更好的方法来处理这种情况?