Search code examples
windowswindows-installerinstallationupgradeinstallshield

MSI - how to prevent registry values to be changed during major upgrade?


I am using Installshiled 2016.

I am trying to create a major upgrade package. Everything works well excluding that registry values are always changed back to their default values after the upgrade.

The scenario is:

  1. Installing fresh first installation.
  2. User modified some of the registry values (such enable logs, servers URL etc.).
  3. Performing a major upgrade.
  4. Registry values that were modified by the user are changed back to their default value (set up by the installer).

I already tried to set "Permanent" to yes, as well as "Never Overwrite" to yes in the components tab (this works well for files but not for registry values).

Another thing worth to mention is that the original package (fresh install) was not set with "Permanent" and "Never Overwrite" to yes. I fixed it up only on a newer package. So I understand that the first upgrade will not work as I expected, however from the second upgrade it should work well, but it doesn't (it works well from the second upgrade for files). When I install the upgrade package (with "Permanent" and "Never Overwrite" set to yes) as fresh installation and trying to upgrade it, it also not working well for registry values, only for files.

What am I missing?

Thanks


Solution

  • During an upgrade, you can use the AppSearch & RegLocator tables to read the existing values into msi properties, and then use those properties as the default values in the newer msi's Registry table. This way you are still deleting and re-writing the values, but the user's data doesn't change after the upgrade.

    UPDATE: read this for a more thorough explanation - http://robmensching.com/blog/posts/2010/5/2/the-wix-toolsets-remember-property-pattern/