nweiler
nweiler

Reputation: 1180

Setting permissions for folder and all sub folders in Wix

All of the relevant links seem to assume that I am using DirectoryRefs and CreateFolder within these. When I run heat I get a .wxs file that consists of <Directory> tags and <Component> tags but not DirectoryRefs. I'd rather not rewrite the whole 5000 line file by hand. Is there a way to edit folder permissions for these tags?

Upvotes: 0

Views: 2574

Answers (1)

Yan Sklyarenko
Yan Sklyarenko

Reputation: 32240

You don't have to rewrite the heat auto-generated fragment. You can reference the directories defined there with the DirectoryRef elements in another fragment.

Most likely you'd like to do the following:

First, change the ID of the root directory in a heat-generated fragment. This can be done by a -dr <DirectoryName> command line switch of heat.exe. Choose a name for the DirectoryName, e.g. MY_ROOT_FOLDER. This is necessary for a convenient reference to that directory in a DirectoryRef element

Next, author a special component (in a different fragment), which is to contain the permissions functionality only. Something like this:

<DirectoryRef Id="MY_ROOT_FOLDER">
  <Component DiskId="1" Id="Permissions" Guid="GUID-GOES-HERE">
    <Condition>...</Condition>
    <CreateFolder>
      <util:PermissionEx GenericAll="yes" User="[LOGON_ACCOUNT]" Domain="[LOGON_DOMAIN]" />
    </CreateFolder>
  </Component>
</DirectoryRef>

Finally, don't forget to include this component to a feature of your choice.

Note, that by default the <util:PermissionEx> element appends permissions to the folder in question and all its descendants.

Upvotes: 5

Related Questions