0

I build new package of program, and compile new msi. Then I try to update program, already installed on PC, but last msi installs one more program instead updating old version

If ProductVersion in wxs doesn't change, it shows repaid dialog. If it is changed, it installs program instead old. But if new package is built, msi installs one more instance of program

 <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>

yzavyalo
  • 18
  • 4

2 Answers2

0

You need to implement a major upgrade: Unable to remove previous versions of MSI. Multiple entry's show up in control panel.

In its simplest form a major upgrade is implemented with this WiX element:

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

Some Help Resources:

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • line 13 in my code is – yzavyalo Sep 04 '19 at 11:48
  • [Please see the list here](https://stackoverflow.com/questions/56989906/wix-does-not-uninstall-older-version/56991527#56991527). – Stein Åsmul Sep 04 '19 at 11:50
  • what to do in case Mismatched Upgrade Code? As I understand it is my case – yzavyalo Sep 04 '19 at 11:58
  • You can keep the old upgrade code there and then add the new one - that should do the trick. You are live, are you? [There is an answer here on detailed control of the upgrade table](https://stackoverflow.com/a/51803320/129130). – Stein Åsmul Sep 04 '19 at 12:05
0

Decision was to add

 AllowSameVersionUpgrades="yes"

to MajorUpgrade

yzavyalo
  • 18
  • 4