WIX安装程序:主要升级到新安装目录

时间:2017-06-08 07:39:59

标签: wix windows-installer installer upgrade major-upgrade

我们使用WiX构建安装包。我是WiX技术的新手,目前正在尝试对已安装的应用程序进行重大升级,但是在与以前版本不同的目录位置。例如,如果产品的v2安装在Program Files(x86)\ Old_path \ Product上,我想将升级版本v3安装在不同的文件夹C:\ Program Files(x86)\ New_path \ Product。

我修改了msi属性INSTALLDIR以获得新的位置路径。我们尝试更改InstallExecuteSequence,在InstallValidate之后添加RemoveRegistryValues以删除注册表中存储的旧路径,并使WriteRegistryValues添加新的注册表值。

<InstallExecuteSequence>
....
    <Custom Action="HxPrepare" Before="InstallValidate">NOT Installed</Custom>
    <RemoveRegistryValues After="InstallValidate" />
    <WriteRegistryValues />
   <Custom Action="HxFinalize" Before="StartServices">NOT Installed</Custom>
....
<InstallExecuteSequence />

但是我看到安装过程没有变化,新文件只被复制到旧的目录路径。即使在修改INSTALLDIR路径后,我可以知道这条旧路径从哪里获得?我们怎样才能在主要升级期间进行此安装路径更改。

回复PhilDW的评论:

这是主要升级的正确过程。将删除所有旧版本文件。但是在我们的应用程序中,升级期间没有浏览对话框要求新的/必需的安装目录。它只需要以前的版本路径。这是因为首先我们需要备份较低版本的重要设置/用户配置文件,然后在升级版本中使用它们。保存此备份后,我尝试将此备份文件移动到新路径,然后开始复制新文件。我在HxPrepare步骤中将此路径更改为INSTALLDIR,并希望在新目录中继续该过程。但我不知道只考虑旧路径。

<InstallExecuteSequence>
<RemoveExistingProducts After="InstallInitialize" />
<Custom Action="PreventDowngrade" After="FindRelatedProducts">DOWNGRADE</Custom>
<Custom Action="HxInit" After="CostFinalize">NOT Installed</Custom>
<Custom Action="HxPrepare" Before="InstallValidate">NOT Installed</Custom>
<Custom Action="HxFinalize" Before="StartServices">NOT Installed</Custom>
<Custom Action="HxPreUninstall" Before="InstallValidate">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>
<Custom Action="HxUninstall" After="InstallInitialize">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>

我想要执行此安装路径更改的原因是因为我想更改产品制造商名称,我希望产品的主要升级发生在新路径上,例如“C:\ Program Files(x86)\ New_manufacturer \产品安装“。我怎样才能做到这一点?

0 个答案:

没有答案
相关问题