'How to skip InstallDir Dialog on upgrade

I would like to supress the InstallDirDlg on upgrade. But my approach doesn't work.

I tried to skip the InstallDirDlg using

<Publish Dialog="InstallDirDlg" Control="Back"
         Event="NewDialog" Value="WelcomeDlg">NOT Installed</Publish>

I tested it by installing Version 1.0.0.0 and then Version 1.0.1.0 but the InstallDirDialog still shows up.

I'm quite new to WiX so maybe I'm missing something.

Here's the Product.wxs file contents:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*" Name="MyApp" Language="1031"
           Version="1.0.1.0" Manufacturer="Abid"
           UpgradeCode="8dc49e86-c23a-4541-bef2-259bdec14a57">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <UI>
      <UIRef Id="WixUI_InstallDir" />
      <Publish Dialog="WelcomeDlg" Control="Next"
               Event="NewDialog" Value="InstallDirDlg">1</Publish>
      <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" 
               Value="WelcomeDlg">NOT Installed</Publish>
    </UI>
    
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
    <Property Id="INSTALLDIR">
      <RegistrySearch Id="ProgramRegistry" Type="raw" Root="HKCU"
                      Key='Software\[Manufacturer]\[ProductName]' 
                      Name='InstallDir' />
    </Property>

    <MajorUpgrade DowngradeErrorMessage="Eine neuere Version von [ProductName] ist bereits installiert." />
    <MediaTemplate EmbedCab="yes" />
<!-- ... --->
</Wix>
wix


Solution 1:[1]

Can you try using NOT OLDERVERSIONBEINGUPGRADED instead of NOT Installed?

  <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">NOT OLDERVERSIONBEINGUPGRADED</Publish>

Solution 2:[2]

NOT Installed won't work since the newer Version, the upgrade itself isn't installed.

If you use the MajorUpgrade element the property

WIX_UPGRADE_DETECTED

should evaluate to true on an upgrade, so try using NOT WIX_UPGRADE_DETECTED in your condition.

As far as I know UPGRADINGPRODUCTCODE and PREVIOUSVERSIONSINSTALLED may also sometimes be set on an upgrade, but those aren't necessarily as reliable.

Solution 3:[3]

This might be an old post, but I recently ran into the same problem and couldn't find a solution here that really works.

As LeonardDM said I had to use the WIX_UPGRADE_DETECTED, yet this alone didn't do the trick. Just in combination with the Order attribute of Publish it really skipped the InstallDirDlg on Updates:

<Publish Dialog="WelcomeDlg" 
         Control="Next" 
         Event="NewDialog" 
         Value="InstallDirDlg" 
         Order="5">NOT WIX_UPGRADE_DETECTED</Publish>
<Publish Dialog="WelcomeDlg" 
         Control="Next" 
         Event="NewDialog" 
         Value="VerifyReadyDlg" 
         Order="2">WIX_UPGRADE_DETECTED</Publish>

Hope this helps anyone still searching.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2
Solution 3 Andreas