You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Wix 4设置安装文件夹ACL权限报错:Directory不支持PermissionEx

解决Wix 4中PermissionEx元素无法作为Directory子元素的错误

Wix 4不允许util:PermissionEx直接作为Directory的子元素,权限配置必须依附于具体的Component。按以下步骤修正:

1. 确认引用Util扩展命名空间

在项目的根Wix元素中添加Util扩展的命名空间声明:

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
     xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">

2. 将PermissionEx移入Component内

把权限配置放到关联目标目录的Component中,同时给Component设置KeyPath(可以用注册表项或占位文件):

<Directory Id="CompanyFolder" Name="!(bind.Property.Manufacturer)">
    <Directory Id="INSTALLFOLDER" Name="!(bind.Property.ProductName)">
        <Component Id="SetInstallFolderPermissions" Guid="*" Directory="INSTALLFOLDER">
            <!-- 用注册表项作为KeyPath,无需额外文件 -->
            <RegistryValue Root="HKLM" 
                          Key="Software\!(bind.Property.Manufacturer)\!(bind.Property.ProductName)" 
                          Name="Installed" Type="integer" Value="1" KeyPath="yes"/>
            <!-- 给Users组设置完全控制权限 -->
            <util:PermissionEx User="Users" GenericAll="yes" />
        </Component>
    </Directory>
</Directory>

额外说明

  • 若仅需读写权限,可替换GenericAll="yes"为更细粒度的配置,比如:
    <util:PermissionEx User="Users" GenericRead="yes" GenericWrite="yes" Delete="yes" />
    
  • 确保项目已通过NuGet安装WixToolset.Util.wixext扩展包,否则无法识别util:PermissionEx元素。

内容的提问来源于stack exchange,提问作者Muiz J Khan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.04 17:46:11