I am trying to to add default value for a created registry key EDIT: (HKLM) but without allowing that value to reset on Repair, and ideally without having to write any code (I think this is something Windows Installer would have in its toolset)
Here is my solution so far:
Added Component which is in charge of adding (or removing) the registry key. The 'data' for this is simply the name of a property [MYPROPERTY]
Added a Property called MYPROPERTY
, this has a value of 1 in the table. It can be changed to 0 by the installing user at the command line.
I added a SetProperty
CA for MYPROPERTY
with a Condition so that it only runs on first Install and not on things like Repair.
The problem I believe is that I have a value of 1 hardcoded for the MYPROPERTY
value in the Property table. Obviously, a Repair will reset it to 1. My question is if there is an alternative way to be looking at this problem. Otherwise, I believe I would have to write custom CA to cache the original value and then restore it after Repair. I guess I am trying to figure out ways of doing things with native Windows Installer instead of code.
Here is what I did, in case this is useful:
REINSTALL~="ALL"
This way if the user changed the value to something other than default, it is restored