简体   繁体   中英

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. (CAQuietExec: Error 0x80070057: failed to get command line data).

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" . 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. This is probably because Windows Installer doesn't natively support the ability to do so.

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? Could it be implemented in 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

Wrap your custom action around a Property with Id set to WixQuietExecCmd.

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

WiX Property Element

WiX Quiet Execution of Custom Action

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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