2

I use WiX 3.8 to create a install pakeage. 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:

<?xml version="1.0" encoding="UTF-8"?>
      <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="{95B5E9E1-AB21-4947-A047-74C169B1D1F2}" Name="Xproduct" Language="1033"  Version="1.0.0.0" Manufacturer="X Limited" UpgradeCode="af9969f2-fb9c-44c7-b207-e89f1d900a91">


<Package Id="*"
     InstallerVersion="301"
     Languages="1033"
             Compressed="yes"

             Manufacturer="X Limited"
             Description="Install"
             Keywords="Installer, MSI"
             Comments="(c) 2013 NCCD X Limited"        
     SummaryCodepage="1252"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
   <Property Id="ALLUSERS" Secure="yes" Value="1" />
      <Property Id="ASSISTANCE_USERS" Value="all"/>
   </Product>
</Wix>

InstallScope.wxs

<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> 

and then setting the ALLUSERS based on ASSISTANCE_USERS,but I don't know where to put it;

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

 <Publish Property="ALLUSERS"
       Value="1">ASSISTANCE_USERS = "all"</Publish>

please tell me how to modify these code to realize the function?

1 Answers1

0

Put this code in the custom UI code in your solution. You can publish the properties within button control tags itself. Please refer the following code of how to publish properties at button clicks.

<Control Id="InstallScopeNext" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="(loc.WixUINext)">
<Publish Property="ALLUSERS" Value="{}">ASSISTANCE_USERS = "cur"</Publish> <!-- set null value -->
<Publish Property="ALLUSERS" Value="1">ASSISTANCE_USERS = "all"</Publish>
</Control>
Nilaksha Perera
  • 715
  • 2
  • 12
  • 36