1
votes

Using a .msi package, I want to create a few registry keys if they don't exist, leave them alone if they do exist, and not delete them if the program is removed. I have done this (using Orca) by adding entries to the following msi tables: Components, FeatureComponents, Registry, & LockPermissions. My question is what should I do about the GUID used in the ComponentID of the Component table for these keys? It seems there are 3 choices.

1) Assign them once and leave them alone in future versions of the msi

2) Assign new ones every time a new version is produced

3) Use NULL (per http://msdn.microsoft.com/en-us/library/aa368007(VS.85).aspx) I have not tried this.

Is one of these to be preferred over the other? Are there any consequences of one over the other? (I'd prefer leaving as little stuff behind as possible if the program is removed).

I am also curious to know what the following comment about the permanent attribute bit (16) means.

If this bit is set, the installer does not remove the component during an uninstall. The installer registers an extra system client for the component in the Windows Installer registry settings.

Where might might these entries be found?

1

1 Answers

0
votes

From the Windows Installer MSDN topic Organizing Applications into Components:

Never create two components that install a resource under the same name and target location. If a resource must be duplicated in multiple components, change its name or target location in each component. This rule should be applied across applications, products, product versions, and companies.

Option (2) would effectively create a new component for the same registry key each time you release a new version, which violates the quoted rule.

Option (3) can be done in wix by setting the component GUID as Guid="". It will make windows installer install the component resources and then "forget" the component. This may do what you want in the sense that the installed resources will not be removed. However, it also means that a "repair" will not be able to restore the registry entries if they go missing.

Therefore you should go for option (1) where you have a fixed GUID, and set the Permanent attribute to keep the reference count for the component non-zero. How windows installer does this internally is an implementation detail that you shouldn't care about, so I don't see the point of looking for those windows installer registry settings.