我尝试同时使用同一安装程序(全新安装和更新)。
[Code]
中的MySQL安装部分将正常执行。[Code]
中MySQL安装的一部分不应执行。那么,如果安装只是在更新,那么如何为这部分代码(MySQL安装)实现异常功能?
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
{ ... }
begin
if CurStep = ssPostInstall then
begin
{ fresh installation code }
end;
end;
答案 0 :(得分:2)
您可以在我的答案中使用IsUpgrade
函数
Can Inno Setup respond differently to a new install and an update?:
虽然它依赖于ssPostInstall
时已经存在的“卸载”注册表项的存在,但是您必须缓存其值。
var
IsUpgradeCached: Boolean;
function InitializeSetup(): Boolean;
begin
IsUpgradeCached := IsUpgrade;
Result := True;
end;
procedure CurStepChanged(CurStep: TSetupStep);
{ ... }
begin
if (CurStep = ssPostInstall) and (not IsUpgradeCached) then
begin
{ fresh installation code }
end;
end;