Wix自定义操作执行cmd不起作用 [英] Wix custom action execute cmd not working

查看:82
本文介绍了Wix自定义操作执行cmd不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在安装wix期间执行自定义操作,并在调用自定义操作时收到错误消息。我想将具有完全控制权的权限组每个人添加到使用cacls的文件夹中。当我从cmd运行它时,它工作正常,但从安装程序中却无法运行。以下是wix安装日志中的错误消息。

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.

信息1721。此Windows Installer软件包存在问题。无法完成该安装所需的程序。请与您的支持人员或包装供应商联系。操作:SetPermissions,位置:,命令: c:\Windows\SysWOW64\cmd.exe cacls c:\Program Files\Test / g每个人:f / e

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

这是我在wix文件中的自定义操作

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>


推荐答案

您可以在Wix中做您想做的事而无需自定义操作:

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

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

要使用Util扩展,您必须添加对WixUtilExtension程序集的引用,并将UtilExtension命名空间添加到wsx文件上的Wix标记如下:

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

这篇关于Wix自定义操作执行cmd不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆