0
votes

I have an IS 2018 InstallScript MSI project. I have made changes in the upgrade view and added an upgrade item to support automatic major upgrades.

Question is how do I detect in the install script if the installation is going to perform a major upgrade.

To be more specific, in the install script .Rul file, in the OnFirstUIBefore function, I want to know if the installation will proceed with 'Major Upgrade' or not and based on that I want to perform certain installation tasks.

Is there any InstallShield InstallScript property that I can check to see if 'Major Upgrade' will be performed?

thanks in advance.

1
From what I can tell (and you may already know), when a "Major Upgrade" is to be performed the install basically behaves as a first-time install. I saw something about the UPGRADINGPRODUCTCODE property but that may not be available in an InstallScript. I also saw that a major upgrade is triggered when Package Code, Product Version and Product Code are changed, but not sure how you can know that via script. - Steve

1 Answers

0
votes

You can use MsiGetProperty to retrieve either IS_MAJOR_UPGRADE or the property you specified in your major upgrade item. If the value you retrieve is not empty, the related product was found, and your installation is going to replace it. (Assuming you didn't set your major upgrade item's detect-only property.)

Note that contrary to the linked example, you will need to reference ISMSI_HANDLE instead of hMSI to access the Windows Installer handle from OnFirstUIBefore, as events don't receive the handle as an argument.

You can also check UPGRADINGPRODUCTCODE, but that's for the related scenario in which the current product is being removed because a major upgrade is replacing it.