首页 文章

WiX - 在多实例安装上进行重大升级

提问于
浏览
5

所以,我有一个Windows服务,可以在一台服务器上安装多个实例 . 安装程序需要能够升级单个实例 . 安装程序使用Instance Transforms,但我不确定如何按照我的意愿进行主要升级 .

为了进行重大升级,我的理解是我应该更改产品代码,因此实例以这种形式定义:

<Instance ProductCode="*"
            UpgradeCode="{SOMEGUID}"
            ProductName="Instance 1"
            Id="Instance1"/>

可以启动msi以通过以下方式安装新实例:

msiexec.exe /i "installer.msi" TRANSFORMS=:Instance1 MSINEWINSTANCE=1

但是,经过多次搜索后,我发现在特定实例上运行升级的唯一方法是这种格式:

msiexec.exe /i "installer.msi" /n {PRODUCTCODE} REINSTALL=ALL REINSTALLMODE=vamus

这个问题是如果产品代码是自动生成主要升级,那么我不知道它是什么,所以我不能传递给命令参数 .

有没有办法使用Instance的UpgradeCode或InstanceID或ProductCode启动升级?因为这两者都会保持静止 . 或者,我可以在没有参数的情况下启动msi,在UI对话框中选择现有实例(通过检查注册表),并设置适当的属性以强制msi进入该实例的升级模式吗?

2 回答

  • 8

    以下是我迄今为止处理3个单独实例升级所做的事情:

    <InstanceTransforms Property="Upgrade">
      <Instance Id="I01" ProductCode="*"  ProductName="Product Instance 1" UpgradeCode="55a25a09-5979-438d-91dd-67755012a288"/>
      <Instance Id="I02" ProductCode="*" ProductName="Product Instance 2" UpgradeCode="a27eb2e5-9aa8-4d09-b6c0-df717875c310"/>
      <Instance Id="I03" ProductCode="*" ProductName="Product Instance 3" UpgradeCode="d705720d-3703-4b17-817e-bd51edd9abea"/>
    </InstanceTransforms>
    

    虽然我的 properties 升级是一个固定的Guid . 有了这个,我可以使用这一行分别处理3个实例及其更新 - 对于新安装,添加MSINEINSTANCE = 1-:

    msiexec / i MyProduct.msi MSINEWINSTANCE = 1 Transforms =“:I01”

  • 1

    很确定你需要 product code ,因为 upgrade code 标识 family of products ,而不是单个 .

    启动 PowerShell 并运行此命令以获取 installed products with product code 的列表:

    Get-WmiObject -Class win32_product
    

    以下是获取 output in a tabular format (IdentifyingNumber为ProductCode)的另一种方法:

    Get-WmiObject Win32_Product | Format-Table IdentifyingNumber, Name, Version
    

    您还可以使用Orca(MSI SDK tool)在已编译的MSI的Property表中找到产品代码:

    enter image description here

相关问题