首页 > 解决方案 > WIX 设置 perUser 或 perMachine 取决于当前用户

问题描述

我是 WIX 的新手。如果当前用户在本地管理员组(不是 runAsAdmin)或perMachine中,我需要将Installscope设置为perUser否则我知道ALLUSERS="2"MSIINSTALLPERUSER="1|{}",但我不能在之前动态设置它们wix 决定它将如何运行 - 作为 perUser 或 perMachine 我使用 CustomAction 来检测当前用户是否在 Administrators 组中并设置ALLUSERSMSIINSTALLPERUSER,放入 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

解决方案


问题已结束。我在 InstallUISequence 中使用自定义操作。


推荐阅读