This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Using UPGRADINGPRODUCTCODE from OnMoved event
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Nov 08, 2007
12:37 AM
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
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
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Nov 08, 2007
10:10 AM
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.