cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Jim1236
Level 3

Tutorial to uninstall old version and then install new version in single installation

Hi,

Could anyone provide steps to uninstall old version and then install new version during installation?
I just couldn't get this up where it keep prompts me error from the situation below:

With package code, product version changed, product code and upgrade remain unchanged.
It gives me error "Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel."

With package code, product code, and product version changed, upgrade code remain unchanged.
It gives me error "A newer version of this application is already installed on this computer. If you wish to install this version, please uninstall the newer version first. Click OK to exit the wizard."

My setting for the Upgrade settings are as below:
Small/Minor Upgrade Settings
- Disable

Major Upgrade Settings
- Completely uninstall old setup before installing new setup
- Products sharing my Upgrade code.
- Min version : Blank
- Include Min version : No
- Max version : ***ALL_VERSIONS***
- Include Max version : No
- Detect Only : Yes
- Detect Property : ISFOUNDNEWERPRODUCTVERSION

Any idea what should I do so that i can just uninstall the previous installed version if found and then continue to install new version in a single installation?
Labels (1)
0 Kudos
(13) Replies
tjohnson1
Technical Writer
Technical Writer

The second scenario is the correct setup but you made the mistake of editing the prevent downgrade item instead of creating a new major upgrade item. The prevent downgrade item is used to check for higher versions but since you changed it to earlier versions you are seeing the message when you normally wouldn't.

Prevent Downgrade item: http://helpnet.flexerasoftware.com/installshield20helplib/installshield20helplib_CSH.htm#helplibrary/PreventingDowngrades.htm
Creating a Major Upgrade: https://flexeracommunity.force.com/customer/articles/en_US/INFO/Q211822
0 Kudos
Jim1236
Level 3

tjohnson1 wrote:
The second scenario is the correct setup but you made the mistake of editing the prevent downgrade item instead of creating a new major upgrade item. The prevent downgrade item is used to check for higher versions but since you changed it to earlier versions you are seeing the message when you normally wouldn't.

Prevent Downgrade item: http://helpnet.flexerasoftware.com/installshield20helplib/installshield20helplib_CSH.htm#helplibrary/PreventingDowngrades.htm
Creating a Major Upgrade: https://flexeracommunity.force.com/customer/articles/en_US/INFO/Q211822



I don't get you what does it mean i edited the Prevent Downgrade Item?
What setting did i changed where i can't really trigger the installer to uninstall the previous version?
0 Kudos
DLee65
Level 13

Select Media > Upgrades
Expand the tree for '+ Upgrade Windows Installer Setup' if it is not already expanded.
Select this top tree item and view the settings. This controls how the uninstall works. For me I completely uninstall the old setup before installing a new setup because there are some unversioned files that I find problematic with the second option. But the second option is faster. It is worth testing to see if it will work for you.
You want to add a new entry here if it does not already exist. The default entry for Prevent downgrades is inserted when you create a new project and is ONLY for detecting a newer version. Do not modify this entry, create a new one using a right click on the top of the tree and select option for a new major upgrade item.
I have an entry for "NewUpgradeForCurrentProject" (note that the name is not important, it just helps me to identify it)
On the Common Tab select the option 'Products sharing my upgrade code'. NOTE: Never change your upgrade code for an active product. Only change your product code and product version and package code.
You can specify a range of version numbers to include or select 'Any earlier version'.
Double check the advanced tab - these should be automatically set for you based on your settings on Common. Note that by default Maximum Version is set to ***ALL_VERSIONS***. This is because when your project builds, InstallShield will inject the current Product Version here.
Set a Detect Property here. You can use this detect property to specify a message to display like notifying the consumer that the current version will be uninstalled. However, it is not necessary to do this. I don't but I just wanted to point out that you can use this property to control the text on a particular dialog, for instance the welcome dialog.

It can take a little bit to better understand the upgrade process. MSDN has some great articles on the upgrades. When you have a chance do a search for MSDN major upgrade and also MSDN windows installer patches. It will help in the long run because you will better understand what options are available to you.
DLee65
Level 13

I just read your post again.

One thing to note is that for a major upgrade, which involves the uninstall process you desire, you MUST change the product code.
We see the message you indicated during internal testing because I do not alter the product code for each build, just at the start of the build cycle. So QA must manually uninstall the previous version in this case. However, they are required to test upgrade from a previous release where the package code has changed.

The configuration that you described is a minor upgrade scenario.
0 Kudos
Jim1236
Level 3

Ya, the problem i faced now is that user has to manually uninstall the previous version and then only proceed to install the new version.
This is to be avoided for user experience purposes.

I attempt to create a major upgrade, and somehow it is successful now where the previous version is uninstalled first and the new version will be installed.
Somehow the process is something like a normal new installation where i just need to double click the executable, and it will undergo a normal new installation.
When the new installation progress takes place, i noticed that the previous version is being uninstall silently without notifying the user.
I need to show user that the previous version will be uninstall via a message.
Does the Detect Property you mentioned is used for the message box I needed?
I need to do it with a InstallScript? or could you advise me a proper way of doing this?
0 Kudos
Jim1236
Level 3

I've got it to work where it detects any existing earlier version, it will uninstall it and install the new version.
Then what if it detects any existing advanced version, is it possible to make it to uninstall first and then install the new version using the Major Upgrade?
Which means i just want it to uninstall any existing version regardless of the version and the proceed with the new installation. is this possible?
0 Kudos
DLee65
Level 13

It is certainly possible.
When you create a new MSI installer package in InstallShield a default entry is added to the upgrade table.

Under Media check 'Upgrades'
Look under 'Upgrade Windows Installer Setup'. Read through the Upgrades View help documentation on the right.
Look for the ISPreventDowngrade entry.
Note that if you look at the Advanced settings, this is a 'Detect Only' option. Basically it will detect if a version exists newer than the version displayed in the UI. If one does exist it sets the property ISFOUNDNEWERPRODUCTVERSION, what you do with this property is up to you. In the InstallExecuteSequence there is a custom action that uses this property, ISPreventDowngrade.

I think you can achieve what you want by deleting the ISPreventDowngrade entry in the Upgrades view. Hopefully the info above helps you better understand how all of this fits together. 🙂
0 Kudos
Jim1236
Level 3

DLee65 wrote:
It is certainly possible.
When you create a new MSI installer package in InstallShield a default entry is added to the upgrade table.

Under Media check 'Upgrades'
Look under 'Upgrade Windows Installer Setup'. Read through the Upgrades View help documentation on the right.
Look for the ISPreventDowngrade entry.
Note that if you look at the Advanced settings, this is a 'Detect Only' option. Basically it will detect if a version exists newer than the version displayed in the UI. If one does exist it sets the property ISFOUNDNEWERPRODUCTVERSION, what you do with this property is up to you. In the InstallExecuteSequence there is a custom action that uses this property, ISPreventDowngrade.

I think you can achieve what you want by deleting the ISPreventDowngrade entry in the Upgrades view. Hopefully the info above helps you better understand how all of this fits together. 🙂


Hi Lee,

So your saying without any upgrade entry in the Upgrades View, it will also uninstall the existing version automatically during the installation?
Or i still need to create new entry and get the right configuration to achieve the end result?
0 Kudos
DLee65
Level 13

I would try creating an entry that leaves the max value empty. I am sure you require an entry in the Upgrade table to accomplish what you require.
Enter your minimum version, such as 1.0.0

Make sure that your upgrade code has not changed during the history of your product, if so add the previous upgrade codes that are eligible for upgrade.
0 Kudos
Jim1236
Level 3

DLee65 wrote:
I would try creating an entry that leaves the max value empty. I am sure you require an entry in the Upgrade table to accomplish what you require.
Enter your minimum version, such as 1.0.0

Make sure that your upgrade code has not changed during the history of your product, if so add the previous upgrade codes that are eligible for upgrade.


Then, what setting do i need to set for the Include Min/Max setting to Yes? or No?
What if i leave the minimum version to empty, this should means it includes any version before the current installation version?
And leaving the maximum version to empty, this should means it includes any version after the current installation version?
Isn't it?
0 Kudos
PlinyElder
Level 7

Jim, was there any resolution to this? I am looking to perform the same actions as you are.
0 Kudos
Jamesbo
Level 5

tjohnson1 wrote:
The second scenario is the correct setup but you made the mistake of editing the prevent downgrade item instead of creating a new major upgrade item. The prevent downgrade item is used to check for higher versions but since you changed it to earlier versions you are seeing the message when you normally wouldn't.

Prevent Downgrade item: http://helpnet.flexerasoftware.com/installshield20helplib/installshield20helplib_CSH.htm#helplibrary/PreventingDowngrades.htm
Creating a Major Upgrade: https://flexeracommunity.force.com/customer/articles/en_US/INFO/Q211822


Thank you tjohnson! I made the same mistake in initially having altered the ISPreventDowngrade entry and the links you provided helped me fix it and get back on the right track.
0 Kudos
Jamesbo
Level 5

Well I had it working but managed to break it somehow...
The old version I have uninstalls (all files and shortcut removed) and the major upgrade installs fully, but in the add/remove programs (ARP) I still have an entry for the old version, which throws an error if you attempt to remove it from ARP.

Any ideas or should I start a different thread? (for clarity I am not Jim1236)
0 Kudos