0
votes

I use WIX 3.5 to create an MSI installer for a DLL.

I would like to make one installer that allows a simple user to install the program (per user) and also an administrator (per machine).

The registry entries I have to define, are different depending on the user preference:

If he select the "per user" option, the registry entry is HKEY_CURRENT_USER ,
as opposed if he select the "per machine" option, the registry entry is HKEY_LOCAL_MACHINE.

This is how the registry entry should be defined in code in case of per machine (HKLM):

<Component Id="AdminAddinsRegEntries" Guid="8777A7AB-B147-4850-9F25-65011306E9C6" >
  <RegistryKey Root="HKLM" Key="Software\Sparx Systems\EAAddins\AdminAddins" Action="createAndRemoveOnUninstall">
     <RegistryValue Type="string" Value="AdminAddins.MyClass" />
  </RegistryKey>
</Component>  

This is how the registry entry should be defined in code in case of per user (HKCU):

<Component Id="AdminAddinsRegEntries" Guid="8777A7AB-B147-4850-9F25-65011306E9C6" >
  <RegistryKey Root="HKCU" Key="Software\Sparx Systems\EAAddins\AdminAddins" Action="createAndRemoveOnUninstall">
     <RegistryValue Type="string" Value="AdminAddins.MyClass" />
  </RegistryKey>
</Component>  

How can I add the condition to avoid two different installers?

1

1 Answers

0
votes

In that specific registry case, you use the HKMU registry key for, it does that switch for you. In the more general case you'd perhaps need to follow these guidelines depending on what else is in your install:

http://msdn.microsoft.com/en-us/library/windows/desktop/dd408068(v=vs.85).aspx