如果在Inno Setup中更新了安装,则在ssPostInstall步骤中排除“代码"部分的一部分 [英] Excludes part of Code section in ssPostInstall step if installation is update in Inno Setup
本文介绍了如果在Inno Setup中更新了安装,则在ssPostInstall步骤中排除“代码"部分的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试同时使用同一安装程序(全新安装和更新).
I try to use same installer for both (fresh installation and update).
- 因此,如果用户首次尝试安装我的应用程序,它将作为前提条件运行包括MySQL安装程序在内的完整安装,并且
[Code]
中的MySQL安装部分将正常执行. - 但是,如果用户已经安装了我的应用程序,并且安装程序是较新的版本(更新),则不应执行
[Code]
中的MySQL安装部分.
- so if user try to install my application for first time it will run the full installation included MySQL installer as prerequisites, and the part of MySQL installation within
[Code]
will execute normally. - but, if user already installed my application, and the installer is newer version (update), the part of MySQL installation within
[Code]
shouldn't be execute.
那么,如果安装只是在更新,那么如何为这部分代码(MySQL安装)实现异常功能?
So, how to implement exception function for this part of code (MySQL installation) if the installation is just updating?
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
{ ... }
begin
if CurStep = ssPostInstall then
begin
{ fresh installation code }
end;
end;
推荐答案
您可以在我对
的回答中使用 IsUpgrade
函数 Inno Setup能否对新安装和更新做出不同反应?:
尽管它依赖于在 ssPostInstall
时已经存在的卸载"注册表项的存在,但是您必须缓存其值.
Though as it relies on a presence of "Uninstall" registry key, which already exists at the time of ssPostInstall
, you have to cache its value.
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;
这篇关于如果在Inno Setup中更新了安装,则在ssPostInstall步骤中排除“代码"部分的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文