Remember installation directory for upgrade

May 26, 2015 at 11:58 AM
Is it true, that WixSharp/Wix by default does not remember the location where the application was installed when you allow the user to change the location?

You have to store the installdir in registry yourself, and retrieve it from there using the registry ?

Could you provide an example (it may be a good candidate to add to the example directory)?

so install location should be:
  • first install : what is supplied in setup ( absolute or %ProgramFiles% relative dir) or what the user chooses
  • upgrade : what was selected in first install
Coordinator
May 28, 2015 at 12:55 AM
It is actually simple and one of the discussions here covered that task exactly. Unfortunately cannot find it.

Anyway during the first install (after InstallExecute) you need to save [INSTALLDIR] into the registry somewhere. If you use ManagedAction it's straightforward, if WiX then you have to ensure that regvalue is not removed on uninstall, which is a first step of upgrading. In the new version msi ensure (on AppSearch stage) read regvalue into [INSTALLDIR] property. Again it's obvious how to do in ManagedAction but if you rely on WiX only then you will need to use RegValueProperty (RegistrySeearch sample).
Coordinator
May 29, 2015 at 11:13 AM
I remember now that the result of that discussion (that I could not find) was captured in the "Persisting AppInfo" sample. I checked and indeed it illustrates exactly your scenario.