WiX and ARPINSTALLLOCATION

I want my MSI package to write the value InstallLocation

to HKEY_LOCAL_MACHINE\SOFTWARE\\(Wow6432Node)\Microsoft\Windows\CurrentVersion\Uninstall\\(GUID)

. You should also see this value in the Add / Remove Programs panel (column Location

).

To set this value over WiX, I read that the ARPINSTALLLOCATION property must be set using a custom action. I reduced it <Product>

to a minimum. This is how it looks:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <Product Id="*" 
           Name="MyApplication"
           Language="1033" 
           Version="!(bind.FileVersion.MyApplication.exe)" 
           Manufacturer="Me"
           UpgradeCode="db37f5dc-68c5-46ee-bbdf-704ff68b70db">
    <Package InstallerVersion="400" Compressed="yes" InstallScope="perMachine" Languages="0" />
    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />

    <!-- use SetProperty as suggested by Rolo -->
    <SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="CostFinalize" />
    <Feature Id="ProductFeature" Title="MyApplication" Level="1">
      <ComponentGroupRef Id="MyApplication.Files.AllRequired" />
    </Feature>
  </Product>
  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLDIR" Name="MyApplication" />
      </Directory>
    </Directory>
  </Fragment>
  <Fragment>
    <ComponentGroup Id="MyApplication.Files.AllRequired">
      <Component Id="ProductComponent" 
                 Guid="90EA8F1C-77D2-40E1-81AD-44B076EFAB9D" 
                 Directory="INSTALLDIR">
        <File Id="MyApplication.exe" Source="$(var.MyApplication.TargetDir)\MyApplication.exe" />
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>

      

MSI ships with a standard WiX bootstrap.

+3


source to share


1 answer


You must perform your custom action in both sequences (InstallExecuteSequence and InstallUISequence) and execute it after CostFinalize.

You can simplify this by using something like this:



<SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="CostFinalize" />

      

+6


source







All Articles