简体   繁体   English

卸载完成后如何在 Wix 中执行自定义操作

[英]How to execute Custom action in Wix after Uninstall completed

I have enabled logging using below code:我已使用以下代码启用日志记录:

<Property Id="MsiLogging" Value="voicewarmupx!"/>

and I want to copy log file from temp folder to custom Log location.我想将日志文件从临时文件夹复制到自定义日志位置。 I have written a custom action as below我写了一个自定义动作如下

<CustomAction Id="CopyLogFile" Execute="immediate"
          ExeCommand="cmd /c copy [MsiLogFileLocation] [LogsFolder]"
          Directory="TARGETDIR" 
          Impersonate="no" 
          Return="asyncNoWait" />
<InstallExecuteSequence>
  Custom Action="CopyLogFile" OnExit="success"></Custom>

After successful installation above code works fine but when I do Uninstall the code is not working.成功安装后,上面的代码工作正常,但是当我卸载时,代码不起作用。

Any one please help me to move file from Temp folder to specific folder after uninstall.?任何人请帮我在卸载后将文件从临时文件夹移动到特定文件夹。?

The specify the condition for the Custom Action to be invoked on an uninstall: (REMOVE="ALL") AND NOT UPGRADINGPRODUCTCODE .指定卸载时调用自定义操作的条件: (REMOVE="ALL") AND NOT UPGRADINGPRODUCTCODE

This should work:这应该有效:

<CustomAction Id="CopyLogFile" Execute="immediate"
          ExeCommand="cmd /c copy [MsiLogFileLocation] [LogsFolder]"
          Directory="TARGETDIR" 
          Impersonate="no" 
          Return="asyncNoWait" />

<InstallExecuteSequence>
  <Custom Action="CopyLogFile" OnExit="success">(REMOVE="ALL") AND NOT UPGRADINGPRODUCTCODE</Custom>
...

See the full property references you can use in the Microsoft Docs .请参阅您可以在Microsoft Docs中使用的完整属性引用。

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

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