Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WiX - How do I set property conditionally [duplicate]

Tags:

wix

Possible Duplicate:
Wix - change the installation folder based on privilege

Well this question arised when I was trying to solve my problem in How do I get different registry keys for allusers and single user.

Basically what I'm trying to do is:

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

Anyone know to do this?

like image 230
Deqing Avatar asked Aug 14 '12 07:08

Deqing


1 Answers

Ok, just finished. My wxs looks like:

<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 @shambulator for the link. Note that I use After="AppSearch" instead of Before="CostFinalize" because that will make action executing right after registry search.

like image 52
Deqing Avatar answered Nov 10 '22 03:11

Deqing