通过Wix bootstrapper更新MSI包

时间:2015-01-09 16:20:21

标签: wix windows-installer

我有wix bootstapper,它包含4个组件:tree exe包和一个msi包。我想使用下面的bootstrapper(仅主代码)对msi包进行重大更新:

<Bundle Name="$(var.Name)" Version="$(var.Version)" Manufacturer="$(var.Manufacture)" UpgradeCode="$(var.UpgradCode)" Copyright="$(var.Copyright)">
....
<Chain>
      <!-- TODO: Define the list of chained packages. -->
      <PackageGroupRef Id="NetFx4Full"/>
      <PackageGroupRef Id="PostgreSQL"/>
      <PackageGroupRef Id="AdobeReader"/>
      <PackageGroupRef Id="Application"/>
</Chain>
....
<PackageGroup Id="Application">
  <MsiPackage Id="MyApplication"
              SourceFile=".\MSI_File\application.msi"
              DisplayInternalUI="yes"
              Permanent="no"
              Vital="yes"
              Visible="no"/>
others packages...
</PackageGroup>

和msi代码:

<Product Id="*"
    Name="$(var.Name)"
    Language="$(var.InstallerLanguage)"
    Version="$(var.Version)"
    UpgradeCode="$(var.UpgradeCode)"
    Manufacturer="$(var.Manufacture)">

<Package Description="$(var.PackageDescritpion)"
        InstallerVersion="200"
        Compressed="yes"
        InstallScope="perMachine"
        InstallPrivileges="elevated"
        Platform="x64"/>

<Media Id="1" Cabinet="contents.cab" EmbedCab="yes" CompressionLevel="high"/>


<Directory Id="TARGETDIR" Name="SourceDir">
</Directory>

<Feature Id="Complete"
             Level="1"
             ConfigurableDirectory="INSTALLDIR">
  <ComponentRef Id="Licence"/>
  <ComponentRef Id="StartMenuFoldersComponent"/>
  <ComponentRef Id="DatabaseConfigFolder"/>
  <ComponentGroupRef Id="BinaryFileGroup"/>
  <ComponentGroupRef Id="DatabaseConfigFileGroup"/>
  <ComponentRef Id="ApplicationConfigFolder"/>
  <ComponentRef Id="RemoveFolderOnUninstall"/>
</Feature>

<!-- Custom actions-->
.....

<InstallExecuteSequence>
  <RemoveExistingProducts After="InstallValidate"/>
  <!--Other custom actions-->
  ......
</InstallExecuteSequence>

要构建我的更新msi和bootstrapp我设置了更大的(对于msi和bootstrapp来说相同)产品版本,例如旧版本有1.0.0.0而更新版本有1.0.1.0。升级代码作为WIX文档说保持不变。运行我的更新安装程序后,新版本的msi不是installig,在安装目录中仍然是旧文件。有谁知道我做错了什么?

@Edit 我也尝试添加MajorUpgrade元素,但之后引导程序没有启动MSI:

<Media Id="1" Cabinet="contents.cab" EmbedCab="yes" CompressionLevel="high"/>
<MajorUpgrade  Schedule="afterInstallInitialize" DowngradeErrorMessage="A later version of     [ProductName] is already installed. Setup will now exit."/>
<Directory Id="TARGETDIR" Name="SourceDir"/>

@Edit 引导程序日志:http://wklej.to/Msczq

1 个答案:

答案 0 :(得分:2)

您需要将升级信息添加到.msi包中。有关http://wixtoolset.org/documentation/manual/v3/howtos/updates/major_upgrade.html的使用,请参见MajorUpgrade element