MSIEXEC using command line REINSTALL not using original INSTALLDIR

367 views Asked by At

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

3

There are 3 answers

1
Netfangled On BEST ANSWER

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.

0
Philm On

Normally the original entries in the directory table are stored for reinstall without that you store them yourself. So there is something "special" in your MSI, if this doesn't work. If you have a custom action which sets directory properties like INSTALLDIR, you should not use it. E.g. give them a condition "Not Installed".

0
Kezza On

I found out that the problem was due to using a wildcard for the product id, so every time a new msi was built it created a new product id.

By fixing this it seemed to resolve the problem, though I have also implemented the registry key option as it will help for upgrades where I do want to change the product id.

Thanks