Wix安装软件包而不是更新

时间:2019-09-03 11:25:14

标签: windows-installer wix3.11

我构建了新的程序包,并编译了新的msi。然后,我尝试更新已经安装在PC上的程序,但是最后一个msi又安装了一个程序,而不是更新旧版本

如果wxs中的ProductVersion不变,则会显示“已偿还”对话框。如果更改,它将安装程序,而不是旧的。但是,如果构建了新软件包,则msi将再安装一个程序实例

 <Product Id="*" 
          UpgradeCode="$(var.UpgradeCode)"
          Name="$(var.ProductName)"
          Version="$(var.ProductVersion)"
          Manufacturer="$(var.Manufacturer)"
          Language="1033">

    <Package InstallerVersion="405"
             Compressed="yes"
             InstallScope="perMachine"
             Languages="1033"
             Comments="Windows Installer Package"/>
    <Media Id="1" Cabinet="product.cab" EmbedCab="yes"/>

    <MajorUpgrade DowngradeErrorMessage="A newer version of $(var.ProductName) is already installed." />

    <UI Id="UserInterface">

      <Property Id="WixUI_Mode" Value="InstallDir" />
      <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
      <Property Id="ARPNOMODIFY" Value="1" />
...

      <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
      <Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
      <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
      <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">NOT Installed AND NOT PATCH</Publish>
      <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">PREVIOUSVERSIONSINSTALLED OR Installed AND PATCH</Publish>
      <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
      <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">LicenseAccepted = "1"</Publish>
      <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
      <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
      <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
      <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
      <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
      <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
      <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" Order="1">NOT Installed</Publish>
      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</Publish>
      <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
      <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
      <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
      <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
    </UI>

2 个答案:

答案 0 :(得分:0)

您需要实施主要升级:Unable to remove previous versions of MSI. Multiple entry's show up in control panel

此WiX元素以最简单的形式进行了重大升级:

<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />

一些帮助资源

答案 1 :(得分:0)

决定要添加

 AllowSameVersionUpgrades="yes"

到MajorUpgrade