2

如何在 Windows 安装程序中禁用升级模式,以便用户在重新安装之前始终被迫卸载。这是因为在我们可能不想处理的许多情况下升级可能会失败。有没有RESINSTALLMODE可以为此更改的选项?

4

2 回答 2

1

InstallShield 的项目模板默认生成使用次要升级策略的 MSI。未定义 MajorUpgrade 规则。

只需导航到媒体 | 升级 | 为升级方案准备设置 | 升级 Windows 安装程序安装程序

在常用选项卡上,将 Small/Minor Upgrade Settings 从 Prompt 更改为 Disable。

假设您没有建立任何自动化来更改产品代码从构建到构建,每个 MSI 都将是一个小/次要升级,并且 Setup.exe(如果生成)将告诉用户执行卸载。如果没有生成 Setup.exe,Windows Installer 将给出一条错误消息,通知用户已经安装了另一个版本的产品,需要先将其删除。

于 2013-04-11T13:33:35.500 回答
-1

您可以通过两种方式阻止它。首先,您可以在新 MSI 检测到旧 MSI 时阻止它。为此,您使用您在表中ActionProperty定义的。Upgrade我将使用 WiX 语法,因为我知道最好(根据需要转换为您的工具):

<Upgrade Id='PUT-YOUR-UPGRADECODE-HERE'>
   <UpgradeVersion Maximum='YourProductVersionHere' Property='OLDPRODUCTSFOUND' />
</Upgrade>

<CustomAction Id='ErrorWhenOldProductFound'
              Error='Please, uninstall previous versions of [ProductName] before continuing' />
<InstallExecuteSequence>
    <Custom Action='ErrorWhenOldProductFound'>NOT Installed AND OLDPRODUCTSFOUND</Custom>
</InstallExecuteSequence>

以下是 WiX v3.5+ 工具集中执行相同操作的简单语法:

<MajorUpgrade DisallowUpgradeErrorMessage='Please, uninstall previous versions of [ProductName] before continuing' />

第二种选择是阻止旧 MSI 中的升级,如果您在发货前添加它。该UPGRADINGPRODUCTCODE属性是在旧的 MSI 中设置的,因此我们可以在其上创建一个启动条件。同样,WiX 语法看起来像(根据需要转换为您的工具):

<Condition Message="[ProductName] cannot be upgraded, please uninstall it manually.">
   Installed OR UPGRADINGPRODUCTCODE
</Condition>
于 2013-04-10T15:12:39.920 回答