Search code examples
wixwindows-installerreinstall

MSIEXEC using command line REINSTALL not using original INSTALLDIR


I am trying to configure Wix to build my msi to only perform build versions (1.0.x) of my product in conjunction with the REINSTALL property, my problem is that when I run the command line: MSIEXEC.exe /i my.msi /l*vx build-inst.log REINSTALL=ALL REINSTALLMODE=vamus it fails to do anything.

I have checked the msi log and found that it is looking for the existing product in the default folder (.\program files (x86)...\myproduct) yet when I installed it the first time I actually used a custom path (c:\myproduct). It was my impression that using REINSTALL the installer would use the installed path of the original product.

Is this actually the case? Should I be specifying the INSTALLDIR on my command line? I would rather not as this is meant for use by clients and I cannot guarantee I will know where the product was installed.

This method of performing "build" upgrades has been suggested in a couple of places but I can not find anything explaining any need to specify the INSTALLDIR

Is there any way to configure this in Wix?

Thanks

Kieran


Solution

  • The easiest solution would be to store the installation directory in the registry and look it up upon reinstalling.

    To look up your registry value, you'd use something of the sort:

    <Property Id="INSTALLDIR">
        <RegistrySearch Id="InstallLocation" Root="HKCU"
            Key="SOFTWARE\Company\Product" Name="Location" Type="raw" />
    </Property>
    

    If the registry value isn't found, the INSTALLDIR property will be set to your directory structure.

    Rob has a complete solution on his blog for when you specify such a property from the command line.