Search code examples
c++wixwindows-installerupgradecustom-action

WiX/MSI - Custom Action - Upgrade Logic


I have some sort of requirement that states that we have to set up scheduler tasks in the install phase and then, naturally, remove them in the uninstall phase.

However this scenario gets complicated when we introduce our upgrade mechanism (we just have major upgrades), where we have to preserve these scheduler tasks.

Because of the way we decided to use upgrade logic:

<RemoveExistingProducts After='InstallFinalize'/>

Our new version gets first install and then the previous versions gets uninstall, therefore unschedule action gets executed and erase scheduler tasks with this:

<Custom Action='CA_unscheduleUpdates' Before="InstallFinalize">
    <![CDATA[Installed]]>
</Custom>

Is there any way to control this scenario in case we're upgrading and just don't fire the unschedule custom action? Maybe do I have something that I can control within my Custom Action C++ code?


Solution

  • You can condition the custom action execution with "Not UPGRADINGPRODUCTCODE".

    http://msdn.microsoft.com/en-us/library/windows/desktop/aa372380(v=vs.85).aspx