There are a few ways to solve this problem but I believe the following is the probably the most efficient. It just requires a few tweaks to what you've done already.
First, I'd put the default values in USERLIST
so that WIXUI_USERLIST
can always be set. Second, need the WIXUI_USERLIST
to be set only once in the UI or Execute sequence. The SetProperty
element doesn't expose this ability but we can get to it using the CustomAction
element. Getting the action to run only once in the sequences is the magic.
The resulting code for setting the properties would go a little like this:
<Property Id="USERLIST" Value="Demo;" Secure="yes">
<RegistrySearch Id="UserList"
Root="HKLM"
Key="[APPLICATIONHIVE]"
Name="UserList"
Type="raw"
Win64="yes" />
</Property>
<!-- replaces SetProperty but adds the ability to run only in the first sequence -->
<CustomAction Id='SetWIXUI_USERLIST' Property='WIXUI_USERLIST' Value='[USERLIST]'
Execute='firstSequence'>
<InstallUISequence>
<Custom Action='SetWIXUI_USERLIST' After='AppSearch' />
</InstallUISequence>
<InstallExecuteSequence>
<Custom Action='SetWIXUI_USERLIST' After='AppSearch' />
</InstallExecuteSequence>
Update: Additionally, I went and double checked my memory against the MSI SDK. The AppSearch action is only executed once. That means I believe you could probably remove all the WIXUI_USERLIST
and custom actions and stuff and just use USERLIST
everywhere. So an even simpler solution is to remove all of this and replace all instances of your WIXUI_USERLIST
with USERLIST
. :)