【发布时间】:2021-07-20 19:01:22
【问题描述】:
我是 WIX 的新手。如果当前用户在本地管理员组(不是 runAsAdmin)或 perMachine 中,我需要将 Installscope 设置为 perUser 我知道 ALLUSERS="2" 和 MSIINSTALLPERUSER="1|{}",但我无法在 wix 决定如何运行之前动态设置它们 -按用户或按机器 我使用 CustomAction 来检测当前用户是否在管理员组中,并设置 ALLUSERS 和 MSIINSTALLPERUSER,放入 InstallExecuteSequence,但此操作始终在 wix 决定之后运行 如何根据当前用户和管理员组动态设置 InstallScope 的此属性? 我的 WIX 示例
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SetupProject1" Language="1033" Version="1.0.0.0" Manufacturer="rrr" UpgradeCode="3664d946-e6b5-468f-8154-0506308d85ab">
<Package InstallerVersion="200" Compressed="yes" >
</Package>
<Binary Id="CustomActionBinary" SourceFile="$(var.CustomAction1.TargetDir)$(var.CustomAction1.TargetName).CA.dll"/>
<CustomAction Id="SampleAction" BinaryKey="CustomActionBinary" DllEntry="CustomAction1" Execute="immediate" Return="check"/>
<InstallExecuteSequence>
<Custom Action='SampleAction' Before='SetProps'/>
</InstallExecuteSequence>
</Product>
</Wix>
在 SetProps 里面 ALLUSERS 和 MSIINSTALLPERUSER 设置为 2 和 1 但是安装程序是通过 UAC 调用运行的(由于 perMachine)
【问题讨论】:
标签: wix