ramit
Posts: 90
Joined: Thu Dec 18, 2008 11:51 am

Uninstall previous Version when installing New Version

Hi,

I my system application in already installed.
When I tried to run new installer for same application it is displaying me the attached message.
Is it possible, if application is already installed and user wants to install new installer,
it just ask to remove the previous version and then install new installer.

Thanks
Amit
Attachments
Installer.JPG
Installer.JPG (12.82 KiB) Viewed 33334 times
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Uninstall previous Version when installing New Version

Hi Amit,

Usually this message is shown if you created a package, installed it, modified its contents and then you tried to install it again without uninstalling the original one. Basically, Windows Installer can upgrade the original package only if the modified one has a higher version and a different Product Code.

If you don't want to create a new version of the package you need to uninstall the original MSI before installing the modified one. However, if you want to create a new version which will upgrade the old one, you can follow the steps explained in the Upgrades article.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jbridges
Posts: 38
Joined: Fri Jun 09, 2006 12:36 am

Re: Uninstall previous Version when installing New Version

I found what I think is a better solution for our environment.

I package the installer, consisting of bootstrapper, ini and msi/cab files, along with a preinstall.exe (AutoIt3 compiled script) in a self-extracting executable file.

The self-extracting package is created by PackageForTheWeb - an ancient free tool from the days I used InstallShield. But it has the ability to not only specify the file to execute on unpack, but also allow command line option to select another file. So I have:

Preinstall.exe
AutoInstall.exe
MyProduct.exe (bootstrapper)
MyProduct.ini
MyProduct.msi

The preinstall.exe checks the ProductCode in the msi file and then sees if that ProductCode is in the registry (Windows Installer automation object). If it is found, then the preinstall script knows to NOT execute the MyProduct.exe because it will just give the user the popup message you indicate. So, instead, it tells the user it is going to uninstall the old build and install the new one. So it is the preinstall that invokes the bootstrapper after the old build is uninstalled. A tremendous convenience for our internal testing.

The AutoInstall.exe takes it a step further and does a silent uninstall/install for automated testing jobs.

When it comes time to create a CD for customers, I unpack the internal build that was tested and throw away the preinstall and autoinstall. Plus, add the prerequisites. Prerequisites are NOT packaged with each build because they are enormous and redundant from build to build.
MindTooth
Posts: 37
Joined: Mon Aug 17, 2009 12:40 am

Re: Uninstall previous Version when installing New Version

Is it possible to add a message where the installer ask the user, whether or not, he wants to upgrade? Since now it automatically removes the old package, and there is no guarantee that the new package is what he wants.

Birger :)

(I know this is an old topic, but its kinda the same subject.)
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Uninstall previous Version when installing New Version

Hello,

You can achieve this functionality using the "Allow side by side installs of different product versions" option found on the Upgrades page. Then you can add the UpgradeDlg from the Upgrades page. Thus a user will be prompted whether he wants to overwrite the previous install or he wants to install side by side.

You could additionally search for an existing install beforehand and then use the result to conditionally display the UpgradeDlg.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
csuporj
Posts: 4
Joined: Fri Sep 11, 2009 9:10 pm
Contact: Website

Re: Uninstall previous Version when installing New Version

MindTooth wrote:Is it possible to add a message where the installer ask the user, whether or not, he wants to upgrade? Since now it automatically removes the old package, and there is no guarantee that the new package is what he wants.
I need a dialog that tells the user that the old version will be upgraded to the new one. Currently when I have an old version installed and I install the new one, the same dialog is shown as when there isn't any old version installed. I don't want to allow side-by-side install, because our program is not capable of that (it is a service dealing with hardware).

So, how can I do that ?
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Uninstall previous Version when installing New Version

Hello,

You can add a new dialog to the install sequence, then conditionally display that dialog using the OLDPRODUCTS property. OLDPRODUCTS only has a value when previous versions of your product are already installed on the machine, thus your dialog will only be displayed in that case.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
svArt
Posts: 3
Joined: Wed May 25, 2016 2:52 pm

Re: Uninstall previous Version when installing New Version

GabrielBarbu wrote:Hello,

You can achieve this functionality using the "Allow side by side installs of different product versions" option found on the Upgrades page. Then you can add the UpgradeDlg from the Upgrades page. Thus a user will be prompted whether he wants to overwrite the previous install or he wants to install side by side.

You could additionally search for an existing install beforehand and then use the result to conditionally display the UpgradeDlg.

Regards,
Gabriel
Hi,

For the life of me I can't get anything to work.
Scenario: Builds using product version variations lower than Build (i.e. Revision). Of course I want to be able to install them over an existing version. I'm not making them for myself (well, in theory)
-> So I want to be able to always uninstall A VERSION (no matter if it's the same (-ish) version being installed) before installing a new one. That really shouldn't be so hard, should it?
Single .EXE in Enterprise
Windows 10

I've tried running custom actions before the install (at the very FIRST position in the wizard stage) - but it seems they're not even executed because nothing runs if the "already installed" error message pops up.
I've tried enabling side-by-side installations and checking for upgrade key

But all to no avail.

Is there a problem with Windows 10 in this regard?
Are there more detailed descriptions available? I'm probably doing something wrong.
("adding a dialog from the Upgrades page", for example, had me guessing. There is no direct way to add a dialog from there, I added it via the Dialogs page...)
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Uninstall previous Version when installing New Version

Hello and welcome to our forums,

In order to overcome this behavior and always uninstall the existing product you can use our "Uninstall a package with the same version (if found)" option. Please note this option is available only when building an EXE setup package type.

Here are the steps to proceed:
1. go to "Builds page -> Configuration" tab and enable an EXE package type option
2. check the "Uninstall a package with the same version (if found)" option and rebuild your setup project

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
svArt
Posts: 3
Joined: Wed May 25, 2016 2:52 pm

Re: Uninstall previous Version when installing New Version

Daniel wrote:Hello and welcome to our forums,

In order to overcome this behavior and always uninstall the existing product you can use our "Uninstall a package with the same version (if found)" option. Please note this option is available only when building an EXE setup package type.

Here are the steps to proceed:
1. go to "Builds page -> Configuration" tab and enable an EXE package type option
2. check the "Uninstall a package with the same version (if found)" option and rebuild your setup project

Let us know if this helped.

All the best,
Daniel
Yes! Thank you!

Now, of course it would be nice to ask the user if the application should be uninstalled (in case they cancel before installing and then wonder where their old version went) - how can I include a dialog before that?
Before I checked that option (kicking myself for not finding it myself), I was not able to display a dialog before anything else...
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Uninstall previous Version when installing New Version

You're always welcome.
Now, of course it would be nice to ask the user if the application should be uninstalled (in case they cancel before installing and then wonder where their old version went) - how can I include a dialog before that?
Before I checked that option (kicking myself for not finding it myself), I was not able to display a dialog before anything else...
Thank you for your suggestion. Maybe will consider such an improvement in the future.

I'm afraid the related check (for another version already installed) is done by Windows Installer at the very beginning of the installation and you cannot add any other dialog before the related error prompt.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
svArt
Posts: 3
Joined: Wed May 25, 2016 2:52 pm

Re: Uninstall previous Version when installing New Version

Daniel wrote:You're always welcome.
Now, of course it would be nice to ask the user if the application should be uninstalled (in case they cancel before installing and then wonder where their old version went) - how can I include a dialog before that?
Before I checked that option (kicking myself for not finding it myself), I was not able to display a dialog before anything else...
Thank you for your suggestion. Maybe will consider such an improvement in the future.

I'm afraid the related check (for another version already installed) is done by Windows Installer at the very beginning of the installation and you cannot add any other dialog before the related error prompt.

All the best,
Daniel
Ah, I see...
I really think having an insertion point before the installation runs (in the bootstrapper) would be a much needed or even necessary thing to have. I hope it gets implemented, that would round this great software off nicely :)

Return to “Common Problems”