2

我使用 WiX 3.8 创建安装包。我的安装程序应该启用每用户和每机器安装。我想通过使用单选按钮(“Everyone”和“Just me”)来实现这一点。

我在互联网上找到了一些参考资料:

选择当前用户或所有用户安装:添加用户界面,另一个 WiX 教程 - 第 2 部分 - 添加 UI 的一部分。将 ALLUSERS 属性设置为空字符串:Using WiX 3.0 to create per-user MSI that doesn't prompt for elevation on Windows Vista 如果我理解正确,我的安装程序应将 ALLUSERS 属性设置为 1 以进行每台机器安装并设置为“” (空字符串)用于每个用户的安装。

我的问题是无论我尝试什么,ALLUSERS 总是设置为 1。即使我根本没有设置它!

这是我尝试过的几件事:

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

安装范围.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> 

然后根据 ASSISTANCE_USERS 设置 ALLUSERS,但我不知道该放在哪里;

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

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

请告诉我如何修改这些代码来实现功能?

4

1 回答 1

0

将此代码放入解决方案中的自定义 UI 代码中。您可以在按钮控件标记本身内发布属性。请参考以下关于如何在按钮单击时发布属性的代码。

<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>
于 2016-09-26T05:10:59.487 回答