Wix:如何设置文件夹和所有子文件夹的权限

发布于 2024-10-04 11:17:02 字数 355 浏览 0 评论 0原文

我知道如何设置文件夹的权限:

<DirectoryRef Id="ProgramFilesFolder">
  <Directory Id="PHPFolder" Name="PHP">
    <Component Id="PHP_comp" DiskId="1" Guid="*">
      <CreateFolder>
        <Permission User="Everyone" GenericAll="yes" />
      </CreateFolder>

但是我也需要将权限应用于所有子文件夹。如果不列出所有文件夹,这可能吗?

I know how to set the permissions for a folder:

<DirectoryRef Id="ProgramFilesFolder">
  <Directory Id="PHPFolder" Name="PHP">
    <Component Id="PHP_comp" DiskId="1" Guid="*">
      <CreateFolder>
        <Permission User="Everyone" GenericAll="yes" />
      </CreateFolder>

However I need the permissions to be applied to all subfolders as well. Is this possible with out listing all the folders?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

哀由 2024-10-11 11:17:02

首先,我建议您使用 PermissionEx 代替。它是一个标准的 WiX 扩展,与 Permission 相比,它有一个巨大的优势 - 它不会覆盖,但会修改 ACL。默认情况下,它将权限应用于该文件夹及其所有后代文件和文件夹,因此您无需指定任何额外内容。

希望这有帮助。

First of all, I would recommend you using PermissionEx instead. It is a standard WiX extension and it has one really huge advantage over Permission - it doesn't overwrite, but modifies ACLs. And by default, it applies permissions to the folder and all its descendant files and folders, so you don't have to specify anything extra.

Hope this helps.

超可爱的懒熊 2024-10-11 11:17:02

我解决了:Wix 和 Util 架构中定义了不同的 PermissionEx(Wix PermissionExUtil Extension PermissionEx

我使用了 Util 版本:

  • 添加对 WixUtilExtension 程序集的引用
  • 将 UtilExtension 命名空间添加到 Wix 标记:

  • 指定 Util PermissionEx 版本:

    

I solved: different PermissionEx are defined in Wix and Util schema (Wix PermissionEx and Util Extension PermissionEx)

I used the Util version:

  • Add a reference to WixUtilExtension assembly
  • Add the UtilExtension namespace to the Wix tag:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  • Specify the Util PermissionEx version:
<CreateFolder Directory="DirectoryToManage">
    <util:PermissionEx User="Users" GenericAll="yes" />
</CreateFolder>
沧桑㈠ 2024-10-11 11:17:02
<DirectoryRef Id="INSTALLFOLDER">
        <Component Id="INSTALLFOLDER_Permission" Guid="*">
            <CreateFolder>
                <util:PermissionEx User="Users" GenericAll="yes"/>
            </CreateFolder>
        </Component>
    </DirectoryRef>

上面的答案是正确的,您将设置该文件夹中所有文件夹和文件的权限。

请注意:CreateFolder 标签应该位于组件中,并且该组件必须添加到功能中。

另外,您必须将其添加到编译器和链接器的命令行中:

-ext WixUIExtension -ext WixUtilExtension
<DirectoryRef Id="INSTALLFOLDER">
        <Component Id="INSTALLFOLDER_Permission" Guid="*">
            <CreateFolder>
                <util:PermissionEx User="Users" GenericAll="yes"/>
            </CreateFolder>
        </Component>
    </DirectoryRef>

The answer above is correct, and you will set the permissions to all the folders and files in this folder.

Please note: The CreateFolder tag should be in a component, and this component must be added to a Feature.

Also, you have to add this to the command line of the compiler and the linker:

-ext WixUIExtension -ext WixUtilExtension
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文