cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
PlinyElder
Level 7

Installscript MSI - Can i allow downgrades?

Im trying to figure out how to ALLOW the user to downgrade from lets say version '5.10.5.4' to '5.10.3.1'


I have been looking at the Upgrade table in the direct editor and i cannot see how this is being detected.
I also looked for the Custom Action called ISPreventDowngrade but im not seeing it either
Labels (1)
0 Kudos
(3) Replies
Evan_Border
Level 8

PlinyElder wrote:
Im trying to figure out how to ALLOW the user to downgrade from lets say version '5.10.5.4' to '5.10.3.1'

I have been looking at the Upgrade table in the direct editor and i cannot see how this is being detected.
I also looked for the Custom Action called ISPreventDowngrade but im not seeing it either


ISPreventDowngrade is a "type 19" custom action, meaning that it forces a fatal error, then displays an error message (or just writes to the Event Log if running unattended), and exits the install. It is set up to detect newer versions by using the Upgrade table.

The Upgrade table defines the search condition(s) for the MSI that you're trying to detect. InstallShield sets it to check for it's own UpgradeCode and look for any version newer than the current version. If it finds one that is newer, it sets a Property named ISFOUNDNEWERPRODUCTVERSION. So the ISPreventDowngrade custom action is set to only run if the Propertry ISFOUNDNEWERPRODUCTVERSION exists (because otherwise a newer version wasn't found).

The Upgrade table is where the detection of newer (or older) versions takes place. It can also be used to detect unreleated MSI's such as Adobe Reader or MS Office. So if you create a transform file (for example) and change the condition on ISPreventDowngrade to 0 instead of ISFOUNDNEWERPRODUCTVERSION, you'll be able to downgrade because it will skip the custom action. And if you change the ISPreventDowngrade condition to 1, you'll find it impossible to ever install because you'll get the type 19 custom action error always telling you that a newer version is installed (even if one isn't).
0 Kudos
PlinyElder
Level 7

Thanks for the information Evan, so in the case of an Installscript project, there is no Upgrade table. How is that handled in this case?


**EDIT**
I found the solution in pure Installscript. Its under the OnUpdateUIBefore()


// Check whether the update is older than the currently installed version.
if( nResult = VERSION_COMPARE_RESULT_OLDER ) then
szMsg = SdLoadString( IDS_IFX_ERROR_UPDATE_NOT_APPROPRIATE );
SdSubstituteProductInfo( szMsg );
MessageBox( szMsg, SEVERE );
abort;
endif;
0 Kudos
DLee65
Level 13

PlinyElder,

I looked through the help for the InstallScript setup package options and I do not see a way to 'downgrade' newer versions without requiring users to first uninstall the existing product.

If you happen to know the 'newer' version you might get away with using the Release Wizard and on the update page specify 'version specific' and specify the 'newer' versions. But if you want this to affect any possible 'newer' version then i suspect your users will be required to uninstall first.

The other option is to see if you can intercept the process with the 'OnAppSearch' event. To expose this event in your InstallScript view select 'Before Move Data' from the first drop down box, then select OnAppSearch on the next. The default text added to this states the following:
//---------------------------------------------------------------------------
// OnAppSearch
//
// The OnAppSearch event is called after OnBegin and can be used to search
// for previous versions of the current application. This event is called
// only when the setup is running in first install mode.
//
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//---------------------------------------------------------------------------


Unfortunately I have not generated an InstallScript setup for deployment for years and this is a bit rusty for me.

I wonder if you can detect the newer versions of the application and if found, uninstall the app. I am not certain how this works with InstallScript because traditionally you require a response file for the setup to do things silently. If your UI can vary depending on context then a response file will be very difficult to implement. 😞
0 Kudos