Wix: show user dialog if previous version is found

I want to configure my installer to display a user dialog when the previous version is already installed: after the welcome dialog, the user should see a user dialog OldVersionDlgwith information that the previous version was found and will be automatically deleted.

But for some reason, the property set by the element is UpgradeVersionalways nullwhen I check it in state at UI/Publish Dialog.

Here are the main code snippets.

Product.wxs

<Product Id="*" Version="$(var.Version)" UpgradeCode="$(var.ProductId)"
         Language="1033" Name="$(var.ProductFullName)" Manufacturer="$(var.Manufacturer)">
  <Package Description="$(var.ProductDescription)" InstallerVersion="200" Compressed="yes" 
           Manufacturer="$(var.Manufacturer)" />

  <Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
  <Upgrade Id="$(var.ProductId)">
    <UpgradeVersion Minimum="1.0.0.0" Maximum="$(var.Version)"
                    Property="PREVIOUSVERSIONSINSTALLED"
                    IncludeMinimum="yes" IncludeMaximum="no" />
  </Upgrade>

  <InstallExecuteSequence>
    <RemoveExistingProducts Before="InstallInitialize" />
  </InstallExecuteSequence>
</Product>

WixUI_Wizard.wxs

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="OldVersionDlg">PREVIOUSVERSIONSINSTALLED</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg">NOT Installed</Publish>

"" . , PREVIOUSVERSIONSINSTALLED FindRelatedProducts. Product.wxs, . null.

.

+5
1

​​ WixUI_Wizard.wxs. - WiX . , , PREVIOUSVERSIONSINSTALLED :

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="OldVersionDlg">PREVIOUSVERSIONSINSTALLED</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg">NOT Installed AND NOT PREVIOUSVERSIONSINSTALLED</Publish>
+2

All Articles