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

Raj*_*hDA 5 installation windows-installer wix 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 />
Run Code Online (Sandbox Code Playgroud)

但我发现安装过程没有任何变化,新文件仅复制到旧目录路径。即使修改了 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>
Run Code Online (Sandbox Code Playgroud)

我想要执行此安装路径更改的原因是因为我想要更改产品制造商名称,并且希望产品的主要升级发生在新路径上,例如“C:\Program Files (x86)\New_manufacturer\Product Installation ”。我怎样才能实现这个目标?