MessageBox("1Another version of this product is already installed.\nInstallation of this version cannot continue. To \nconfigure or remove the existing version of this product,\nuse Add/Remove Programs on the Control Panel.",WARNING);
abort;
endif;
return ERROR_SUCCESS;
end;
复制代码
接下去按照安装工程的类型,分两种情况:
1.Basic MSI Project
a. 在Behavior and Logic-->Custom Action and Sequences-->Cutom Action右键,new InstallShield,名字改为CheckOldVersion
b. Function Name选择我们刚创建的函数
c.Custom Action and Sequences-->Sequences-->Installtion-->User Interface右键-->Insert,选择我们刚新建的Cutom Action(CheckOldVersion)
2.InstallScript Project
InstallScript Project中只要在OnFirstUIBefore中的Dlg_Start中插入以上代码就可以了:
当然InstallScript Project也可以使用1的方法来实现版本的检查。
附:把一个Basic MSI Project转为InstallScript Project:
Project-->; Project Converters-->Convert to InstallScript Project.