swrightjet
Level 2

Allow upgrades and downgrades at will

I need to have my installer automatically replace (not side-by-side) WHATEVER version of my application is already on the system.  It could be an upgrade, a downgrade or a re-install.  I have tried several things to make this happen. 

  • I turned off the ISPREVENTDOWNGRADE logic, but that allows a side-by-side installation.
  • I tried creating a PowerShell script to uninstall my application at the beginning of the install.  The install locks up.

I am always doing a "major" upgrade and that works fine, but I can't seem to get the downgrade to work.

I realize that the easiest thing to do is just uninstall the application before installing the older one, but that is unacceptable to my users.

I am fairly new to InstallShield so please help!  BTW, I am on InstallShield 2021.

Labels (1)
0 Kudos
10 Replies
Revenera_Ian
Revenera Moderator Revenera Moderator
Revenera Moderator

Hi @swrightjet,

Thank you for your post.

Could you please provide a screenshot of your Help > About InstallShield screen from your copy of InstallShield that you are using to configure the affected project? This allows me to match the InstallShield service pack level and edition.

Which project type are you using? Basic MSI? InstallScript? Or InstallScript MSI? The project type should be indicated in square brackets on the InstallShield title bar when your affected project is open: [<Project Type>]

Please let us know if you have any questions or concerns. Thanks!

0 Kudos

The project type is Basic MSI.  Thank you.

0 Kudos
shunt
Revenera Moderator Revenera Moderator
Revenera Moderator

The biggest hurdle in allowing a downgrade is Microsofts file versioning rules, as the Windows OS will not allow a file with a lower version to install over a file with a higher version. In addition a non versioned data\config file that is newer will not be overwritten if the modified date is newer than the install date.
These are Windows OS rules and you can read more about them here:
https://docs.microsoft.com/en-us/windows/win32/msi/file-versioning-rules

This means that irrespective of the behaviour that you attempt to force the windows installer engine into performing, the resulting outcome will always be problematic.

The reason the "prevent downgrade" item exists in an Installshield project is to prevent such a problematic scenario occuring - removing the ISPREVENTDOWNGRADE prevents the installer from checking if a later version is already installed and thus enables it to run an earlier version - it does not mean that such a scenerio will work.
The only sure way to downgrade an installer is to remove the existing version before the installer begins.

0 Kudos

"The only sure way to downgrade an installer is to remove the existing version before the installer begins."

How to remove the existing version before the installer begins, please?

0 Kudos

OK. So forget about downgrading.  How can I set up my installer such that it will uninstall ANY version of my application prior to starting the install?  I have tried a PowerShell script in a custom action but that made the installation lock up.  Is there a way to do this through InstallScript or something like that?

Thanks, Steve

0 Kudos
varul
Revenera
Revenera

You can remove the older version only in the UI sequence button action, If you added it to exec sequence it wont work since 2 msiexec wont launch at a same time, its a windows limitation. 

EX: In  installshield welcome dialog add your action in some button action like NEXT button when user click on NEXT button the action will check your older version or any specific version and it will uninstall it.

One thing we should remember here is it wont work in Silent installation, since the action is added to UI sequence Button action which is not available in silent installation.

0 Kudos

Thanks Varul, that got me part of the way there. 

I can use a PowerShell script CA on the NEXT button to do the uninstall.  The only problem is that the uninstall doesn't work (return code 1603) unless I launch the MSIEXEC with "Run as Administrator".  I have already set the "Require Administrative Privileges" to "Yes" so I don't see why that is necessary.  I am running as an administrator and I don't see the UAC message come up. 

Note that I am using an MSI without Setup.EXE and I need to keep it that way.

0 Kudos

Are you running the setup with user has admin privileges or with normal user?

If you are running with normal user try to run by Right click Run As Administrator, you might get an UAC, if he's an standard user.

Try to set the customacton Inscript Execution to Deferred execution and then try, which help to run the customaction in elevated.

You can also try with EXE Customaction(Refer screenshot attached)

https://community.flexera.com/t5/InstallShield-Forum/Custom-Action-to-run-As-Admin/m-p/50133

https://stackoverflow.com/questions/37391137/customaction-run-as-administrator

https://www.itninja.com/question/question-4

0 Kudos

I am running with an administrator user.

I tried setting the execution to "Deferred" but I got an error "2762 cannot write script record".  Based on what I have read online, that option can only be used in the execute sequence, not the UI sequence like I have to use it (see earlier post).

The EXE custom action you suggested won't work because I don't have the Product Code of the package I am trying to uninstall.  It could be any past or future version of my product.  My PowerShell script is looking it up by the application name before uninstalling it.  AFAIK, MSIEXEC doesn't have an option to uninstall an application based on its name.

What else can I try?

Thanks

0 Kudos
amisaxd
Level 1

This thread solved a lot of my questions and helped me somewhere too! 

0 Kudos