cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
RabbitWolf62
Level 2

Using UPGRADINGPRODUCTCODE from OnMoved event

I need to access the UPGRADINGPRODUCTCODE property from the OnMoved event. I need to know when a Major Upgrade is being preformed and a previous installation had been uninstalled. I created a new function to get the value:

function SetUpgradeProductCode(hMSI)
STRING szUpgradeProductCode;
NUMBER nUpgradeProductCodeBuffer;
begin
nUpgradeProductCodeBuffer = 64;
bUpgradeProductCode = FALSE;
if (MsiGetProperty(hMSI, "CustomActionData", szUpgradeProductCode, nUpgradeProductCodeBuffer) == ERROR_SUCCESS) then
bUpgradeProductCode = nUpgradeProductCodeBuffer > 0;
endif;
end;


In the Custom Actions and Sequences view, I then create a set-a-property custom action called GetUpgradeProductCode, with the following parameters:
Property Name: GetUpgradeProductCode
Property Value: [UPGRADINGPRODUCTCODE]
Install Exec Sequence: After InstallInitialize

and another called SetUpgradeProductCode with the following parameters:
Function Name: SetUpgradeProductCode
In-Script Execution: Deferred Execution in System Context
Install Exec Sequence: After GetUpgradeProductCode

This does not work. UPGRADINGPRODUCTCODE is always empty. What am I doing wrong?

Thank You,
Tracy
Labels (1)
0 Kudos
(1) Reply
MichaelU
Level 12 Flexeran
Level 12 Flexeran

RabbitWolf62 wrote:
Property Name: GetUpgradeProductCode
Property Value: [UPGRADINGPRODUCTCODE]
Install Exec Sequence: After InstallInitialize

and another called SetUpgradeProductCode with the following parameters:

If there were no transcription errors in this post, then I believe the problem you are facing is a typo in your set property custom action. It needs to set a property named the same as the action which should receive the CustomActionData in the deferred sequence, not the same as itself.

One good way to make sure the problem is on the setting end (instead of within the deferred action itself) is to take a verbose Windows Installer log and search for the name of the deferred custom action. When Windows Installer launches your action it will log what CustomActionData the action will receive.
0 Kudos