I have a script custom action that is scheduled to run during installation and upgrade:
<InstallExecuteSequence>
<Custom Action="CallInstaller" Before="InstallFinalize">
<![CDATA[NOT Installed OR UPGRADINGPRODUCTCODE]]>
</Custom>
</InstallExecuteSequence>
The script runs without any issues during installation, but always fails during upgrade.
I tried to schedule the custom action to run at many different stages of the InstallExecuteSequence, but nothing worked.
By checking the install folder, I saw that the files were not being moved to the new location during the upgrade. With that, it makes sense that the custom action fails, since there's not even a script to be called.
At some point I realized it could be related to the fact that I had to change the Guid of my components. Now all of them have Guid="*", but the issue persists.
Am I scheduling the custom action in the wrong way? Are there any restrictions that apply only to script custom actions? Why my files are not at the target installation folder when the custom action is started?
UPGRADINGPRODUCTCODEseems to imply that you want to use major upgrades. Normally the conditionNOT Installedis sufficient to run a custom action during first install and during upgrade install, because theInstalledproperty only refers to the current version of the product in a major upgrade scenario (it checks if a product with sameProductCodeis installed, which changes for each version when using Major Upgrades).UPGRADINGPRODUCTCODEis only set for the package to be removed, you typically use it for uninstall conditions only.UPGRADINGPRODUCTCODEand<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of [ProductName] is already installed." />, the minor upgrade actually happens. Going over a tangent here, but would it possible to have a minor upgrade while removing the previous versions without a custom action? As it it right now, the old folder is kept. If I had a custom action, I could possibly deleting it by hand, but it sounds hacky