WiX - How to set a property conditionally

Possible duplicate:
Wix - change the installation folder based on privileges

Well, this question arose when I tried to solve my problem in How to get different registry keys for all users and one user .

I am basically trying to do the following:

if ALLUSERS=1 then
   set InstallDir to Property1
else 
   set InstallDir to Property2

Does anyone know how to do this?

+5
source share
2 answers

Ok, just finished. My wxs look like this:

<CustomAction Id="PerUserInstall"    Property="InstallDir" Value="[INSTALLDIR1]" Execute="immediate" />
<CustomAction Id="PerMachineInstall" Property="InstallDir" Value="[INSTALLDIR2]" Execute="immediate" /> 
<InstallExecuteSequence>
    <Custom Action="PerUserInstall"    After="AppSearch">ALLUSERS="" OR (ALLUSERS=2 AND (NOT Privileged))</Custom>      
    <Custom Action="PerMachineInstall" After="AppSearch">ALLUSERS=1  OR (ALLUSERS=2 AND Privileged)</Custom>
</InstallExecuteSequence>

Thanks to @shambulator for the link. Please note that I use After="AppSearch"instead Before="CostFinalize", because this will lead to the execution of the action immediately after searching the registry.

+6
source

WiX . XML, . :

, , INSTALLDIR1 INSTALLDIR2. , , . INSTALLDIR, . :

Per-User Per-Machine Installation Windows 7

. , "" ( , - ).

+3

All Articles