Setting ALLUSERS in WiX for per-user or per-machin

2019-07-02 01:53发布

问题:

I use WiX 3.5. My installer should enable both per-user and per-machine installation. I would like to achieve that by using radio buttons ("Everyone" and "Just me").

I found a couple of references on the Internet:

  • Selecting current-user or all-users install: Adding a user interface, part of Yet Another WiX Tutorial - Part 2 - Adding the UI.
  • Set the ALLUSERS property to an empty string: Using WiX 3.0 to create a per-user MSI that does not prompt for elevation on Windows Vista

If I understand that correctly my installer should set ALLUSERS property to 1 for per-machine installation and to "" (empty string) for per-user installation.

My problem is no matter what I try ALLUSERS is always set to 1. Even when I don't set it at all!

Here is a couple of things I tried:

<Control Id="UserSelection"
         Type="RadioButtonGroup"
         X="26"
         Y="115"
         Width="305"
         Height="45"
         Property="ASSISTANCE_USERS"
         Text="ASSISTANCE_USERS">
    <RadioButtonGroup Property="ASSISTANCE_USERS">
        <RadioButton Value="cur"
                     X="0"
                     Y="0"
                     Width="295"
                     Height="16"
                     Text="Just me" />
        <RadioButton Value="all"
                     X="0"
                     Y="20"
                     Width="295"
                     Height="16"
                     Text="Everyone" />
    </RadioButtonGroup>
</Control>

and then setting the ALLUSERS based on ASSISTANCE_USERS:

  <Publish Property="ALLUSERS"
           Value="{}">ASSISTANCE_USERS = "cur"</Publish> <!-- set null value -->
  <Publish Property="ALLUSERS"
           Value="1">ASSISTANCE_USERS = "all"</Publish>

However, ALLUSERS is always 1.

I also tried just setting ALLUSERS to an empty string:

<Property Id="ALLUSERS" Secure="yes"/>

This should set ALLUSERS to "", yet it stays "1"

Once I'm able to set ALLUSERS, I should be able to use HKMU for per-user and per-machine installtion.

回答1:

Check a verbose log (using /l*vx): MSI logs every property change so you can see when ALLUSERS is being set.