1
votes

I'm trying to execute a custom action during a wix installation and getting an error when the custom action gets called. I want to add the permission group "Everyone" with full control to a folder using cacls. When I run it from cmd it works fine but from the installer it doesnt work. Below is the error message from the wix installation log.

Info 1721.There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. Action: SetPermissions, location: , command: "c:\Windows\SysWOW64\cmd.exe" cacls "c:\Program Files\Test" /g everyone:f /e

Here is my custom action in the wix file

<CustomAction Id="SetPermissions" Property="PermissionsAction" ExeCommand="&quot;   [SystemFolder]cmd.exe&quot; cacls &quot;[Folder].&quot; /g everyone:f /e" Execute="immediate" Return="ignore"  />
<CustomAction Id="PermissionsAction" BinaryKey="WixCA" DllEntry="CAQuietExec"   Execute="deferred" Return="ignore" Impersonate="no"/>
<InstallExecuteSequence>
  <Custom Action="SetPortalDataPermissions" Before="InstallFinalize">
  </Custom>
</InstallExecuteSequence>
1

1 Answers

4
votes

You can do what you want to do within Wix without custom actions:

<CreateFolder Directory="DirectoryToSetPermissions">
 <util:PermissionEx User="Everyone" GenericAll="yes" />
</CreateFolder>

To use the Util extension you have to add a reference to WixUtilExtension assembly and add the UtilExtension namespace to the Wix tag on your wsx file like so:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">