简体   繁体   中英

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 .

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 .

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