Wix custom action execute cmd not working

余生颓废 提交于 2019-12-24 07:53:48

问题


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:


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">


来源:https://stackoverflow.com/questions/13976360/wix-custom-action-execute-cmd-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!