Make wix installation set upgrade to same folder

Posted by Magnus Akselvoll on Stack Overflow See other posts from Stack Overflow or by Magnus Akselvoll
Published on 2008-09-11T07:47:46Z Indexed on 2010/04/30 20:17 UTC
Read the original article Hit count: 198

Filed under:
|
|

How can I make a major upgrade to an installation set (MSI) built with Wix install into the same folder as the original installation? 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).

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?

Or is there some easier way to achieve this in MSI / Wix?

As reference I paste in my current Wix file below:

<?xml version="1.0" encoding="utf-8"?>

<!-- Package information -->
<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" />

<Upgrade Id='9071eacc-9b5a-48e3-bb90-8064d2b2c45d'>
  <UpgradeVersion Property="PATCHFOUND" OnlyDetect="no" Minimum="0.0.1" IncludeMinimum="yes" Maximum="1.0.0"
                  IncludeMaximum="yes"/>
</Upgrade>


<!-- Useless but necessary... -->
<Media Id="1" Cabinet="MyCompany.cab" EmbedCab="yes" />

<!-- Precondition: .Net 2 must be installed -->
<Condition Message='This setup requires the .NET Framework 2 or higher.'>
  <![CDATA[MsiNetAssemblySupport >= "2.0.50727"]]>
</Condition>

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="MyCompany" Name="MyCompany">
    <Directory Id="INSTALLDIR" Name="Integrat" LongName="MyCompany Integration Framework">

      <Component Id="MyCompanyDllComponent" Guid="4f362043-03a0-472d-a84f-896522ce7d2b" DiskId="1">
        <File Id="MyCompanyIntegrationDll" Name="IbIntegr.dll" src="..\Build\MyCompany.Integration.dll"
              Vital="yes" LongName="MyCompany.Integration.dll" />
        <File Id="MyCompanyServiceModelDll" Name="IbSerMod.dll" src="..\Build\MyCompany.ServiceModel.dll"
              Vital="yes" LongName="MyCompany.ServiceModel.dll" />
      </Component>

      <!-- More components -->
    </Directory>
  </Directory>
</Directory>

<Feature Id="MyCompanyProductFeature" Title='MyCompany Integration Framework' Description='The complete package'
         Display='expand' Level="1" InstallDefault='local' ConfigurableDirectory="INSTALLDIR">
  <ComponentRef Id="MyCompanyDllComponent" />
</Feature>

<!-- Task scheduler application. It has to be used as a property -->
<Property Id="finaltaskexe" Value="MyCompany.Integration.Host.exe" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />

<InstallExecuteSequence>
  <!-- command must be executed: MyCompany.Integration.Host.exe /INITIALCONFIG parameters.xml -->
  <Custom Action='PropertyAssign' After='InstallFinalize'>NOT Installed AND NOT PATCHFOUND</Custom>
  <Custom Action='LaunchFile' After='InstallFinalize'>NOT Installed AND NOT PATCHFOUND</Custom>

  <RemoveExistingProducts Before='CostInitialize' />
</InstallExecuteSequence>


<!-- execute comand -->
<CustomAction Id='PropertyAssign' Property='PathProperty'
	Value='[INSTALLDIR][finaltaskexe]' />
<CustomAction Id='LaunchFile' Property='PathProperty' ExeCommand='/INITIALCONFIG "[INSTALLDIR]parameters.xml"'
              Return='asyncNoWait' />


<!-- User interface information -->
<UIRef Id="WixUI_InstallDir" />
<UIRef Id="WixUI_ErrorProgressText" />

© Stack Overflow or respective owner

Related posts about msi

Related posts about windows-installer