title: Make WiX installation set upgrade to the same folder
body: <p>How can I make a major upgrade to an installation set (MSI) built with <a href="http://en.wikipedia.org/wiki/WiX" rel="noreferrer">WiX</a> install into the same folder as the original installation?</p>
  
  <p>The installation is correctly detected as an upgrade, but the directory selection screen is still shown and with the default value (not necessarily the current installation folder).</p>
  
  <p>Do I have to do manual work like saving the installation folder in a registry key upon first installing and then read this key upon upgrade? If so, is there any example?</p>
  
  <p>Or is there some easier way to achieve this in <a href="http://en.wikipedia.org/wiki/Windows_Installer" rel="noreferrer">MSI</a> or WiX?</p>
  
  <p>As reference, I my current WiX file is below:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Wix xmlns="http://schemas.microsoft.com/wix/2003/01/wi"&gt;
      &lt;Product Id="a2298d1d-ba60-4c4d-92e3-a77413f54a53"
               Name="MyCompany Integration Framework 1.0.0"
               Language="1033"
               Version="1.0.0"
               Manufacturer="MyCompany"
               UpgradeCode="9071eacc-9b5a-48e3-bb90-8064d2b2c45d"&gt;
  
          &lt;!-- Package information --&gt;
          &lt;Package Keywords="Installer"
                   Id="e85e6190-1cd4-49f5-8924-9da5fcb8aee8"
                   Description="Installs MyCompany Integration Framework 1.0.0"
                   Comments="Installs MyCompany Integration Framework 1.0.0"
                   InstallerVersion="100"
                   Compressed="yes" /&gt;
  
          &lt;Upgrade Id='9071eacc-9b5a-48e3-bb90-8064d2b2c45d'&gt;
              &lt;UpgradeVersion Property="PATCHFOUND"
                              OnlyDetect="no"
                              Minimum="0.0.1"
                              IncludeMinimum="yes"
                              Maximum="1.0.0"
                              IncludeMaximum="yes"/&gt;
          &lt;/Upgrade&gt;
  
          &lt;!-- Useless but necessary... --&gt;
          &lt;Media Id="1" Cabinet="MyCompany.cab" EmbedCab="yes" /&gt;
  
          &lt;!-- Precondition: .NET 2 must be installed --&gt;
          &lt;Condition Message='This setup requires the .NET Framework 2 or higher.'&gt;
              &lt;![CDATA[MsiNetAssemblySupport &gt;= "2.0.50727"]]&gt;
          &lt;/Condition&gt;
  
          &lt;Directory Id="TARGETDIR"
                     Name="SourceDir"&gt;
              &lt;Directory Id="MyCompany"
                         Name="MyCompany"&gt;
                  &lt;Directory Id="INSTALLDIR"
                             Name="Integrat"
                             LongName="MyCompany Integration Framework"&gt;
                      &lt;Component Id="MyCompanyDllComponent"
                                 Guid="4f362043-03a0-472d-a84f-896522ce7d2b"
                                 DiskId="1"&gt;
                          &lt;File Id="MyCompanyIntegrationDll"
                                Name="IbIntegr.dll"
                                src="..\Build\MyCompany.Integration.dll"
                                Vital="yes"
                                LongName="MyCompany.Integration.dll" /&gt;
                          &lt;File Id="MyCompanyServiceModelDll"
                                Name="IbSerMod.dll"
                                src="..\Build\MyCompany.ServiceModel.dll"
                                Vital="yes"
                                LongName="MyCompany.ServiceModel.dll" /&gt;
                      &lt;/Component&gt;
  
                      &lt;!-- More components --&gt;
                  &lt;/Directory&gt;
              &lt;/Directory&gt;
          &lt;/Directory&gt;
  
          &lt;Feature Id="MyCompanyProductFeature"
                   Title='MyCompany Integration Framework'
                   Description='The complete package'
                   Display='expand'
                   Level="1"
                   InstallDefault='local'
                   ConfigurableDirectory="INSTALLDIR"&gt;
              &lt;ComponentRef Id="MyCompanyDllComponent" /&gt;
          &lt;/Feature&gt;
  
          &lt;!-- Task scheduler application. It has to be used as a property --&gt;
          &lt;Property Id="finaltaskexe"
                    Value="MyCompany.Integration.Host.exe" /&gt;
          &lt;Property Id="WIXUI_INSTALLDIR"
                    Value="INSTALLDIR" /&gt;
  
          &lt;InstallExecuteSequence&gt;
              &lt;!-- command must be executed: MyCompany.Integration.Host.exe /INITIALCONFIG parameters.xml --&gt;
              &lt;Custom Action='PropertyAssign'
                      After='InstallFinalize'&gt;NOT Installed AND NOT PATCHFOUND&lt;/Custom&gt;
              &lt;Custom Action='LaunchFile'
                      After='InstallFinalize'&gt;NOT Installed AND NOT PATCHFOUND&lt;/Custom&gt;
  
              &lt;RemoveExistingProducts Before='CostInitialize' /&gt;
          &lt;/InstallExecuteSequence&gt;
  
          &lt;!-- execute comand --&gt;
          &lt;CustomAction Id='PropertyAssign'
                        Property='PathProperty'
              Value='[INSTALLDIR][finaltaskexe]' /&gt;
          &lt;CustomAction Id='LaunchFile'
                        Property='PathProperty'
                        ExeCommand='/INITIALCONFIG "[INSTALLDIR]parameters.xml"'
                        Return='asyncNoWait' /&gt;
  
          &lt;!-- User interface information --&gt;
          &lt;UIRef Id="WixUI_InstallDir" /&gt;
          &lt;UIRef Id="WixUI_ErrorProgressText" /&gt;
      &lt;/Product&gt;
  &lt;/Wix&gt;
  </code></pre>