简体   繁体   English

如何在WIX中以静默模式执行自定义操作?

[英]How to execute the custom action in silent mode in wix?

I am trying to execute the custom action at the time of uninstall the installer in wix.It is working perfectly but it is showing the splash screen of cmd prompt at the time of custom action.Latter I tried with CAQuietExec but it is unable to uininstall the installer and giving error. 我正在尝试在wix中卸载安装程序时执行自定义操作。它工作正常,但在自定义操作时显示了cmd提示的初始屏幕。最近我尝试使用CAQuietExec,但无法uininstall安装程序并给出错误。 (CAQuietExec: Error 0x80070057: failed to get command line data). (CAQuietExec:错误0x80070057:无法获取命令行数据)。

The command that I am using is : 我正在使用的命令是:

<Fragment>
<Property Id="ModifyOutlookRegInitSign_14" Value="&quot;[SystemFolder]reg.exe&quot; ADD &quot;HKCU\SOFTWARE\Microsoft\Office\14.0\Outlook\Security&quot; /v InitSign /t REG_DWORD /d 0 /f"/>
    <CustomAction Id="ModifyOutlookRegInitSign_14" BinaryKey="WixCA" DllEntry="CAQuietExec"
                Execute="deferred" Return="check" />
    <InstallExecuteSequence>
      <Custom Action="ModifyOutlookRegInitSign_14" Before="InstallFinalize"></Custom>
    </InstallExecuteSequence>

  </Fragment>

If it is an immediate custom action, the name of the property containing the command line as value must have an Id="QtExecCmdLine" . 如果是立即自定义操作,则包含命令行作为值的属性名称必须具有Id="QtExecCmdLine" For other types of custom actions read Quiet Execution Custom Action . 有关其他类型的自定义操作,请阅读“ 安静执行自定义操作”

It seems to me that you are trying to update HKCU during the uninstall. 在我看来,您正在尝试在卸载过程中更新HKCU。 This is probably because Windows Installer doesn't natively support the ability to do so. 这可能是因为Windows Installer本身不支持此功能。

But your proposed solution is lacking in several way. 但是,您提出的解决方案缺少多种方式。 Mainly that it doesn't support rollback and doesn't support cleaning up other user profiles. 主要是它不支持回滚,也不支持清理其他用户配置文件。

Did this registry entry had to be implemented in HKCU? 此注册表项是否必须在HKCU中实施? Could it be implemented in HKLM? 可以在HKLM中实施吗?

I've created a custom action to kill a process silently like this: 我创建了一个自定义操作来像这样静默地杀死一个进程:

<!-- WixQuietExecCmdLine specify the cmd to be executed -->
<Property Id="WixQuietExecCmdLine" Value='"[WindowsFolder]System32\TaskKill.exe" /F /T /IM MyApp.exe'/>

<!-- From WiX v3.10, use WixQuietExec -->
<CustomAction Id="MyAppTaskKill" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="immediate" Return="ignore"/>

<!-- trigger the custom action -->
<InstallExecuteSequence>
    <Custom Action='MyAppTaskKill' Before='InstallValidate'></Custom>  
</InstallExecuteSequence>

You have more info about the possible configuration combinations here: http://wixtoolset.org/documentation/manual/v3/customactions/qtexec.html 您可以在此处获得有关可能的配置组合的更多信息: http : //wixtoolset.org/documentation/manual/v3/customactions/qtexec.html

Wrap your custom action around a Property with Id set to WixQuietExecCmd. 将您的自定义操作包装在ID为WixQuietExecCmd的Property周围

<Property Id="WixQuietExecCmdLine" Value="command line to run"/>

WiX Property Element WiX属性元素

WiX Quiet Execution of Custom Action WiX安静执行自定义操作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM