Automatically uninstall previous version(s) - Advanced Installer Community
beth
Posts: 5
Joined: Fri Apr 16, 2010 7:11 pm

Automatically uninstall previous version(s)

Hi,

I have been trying to figure out how to have the installer automatically uninstall any previous version. I have found references in other posts such as "...Custom Actions has the UninstallPreviousVersions under "InstallUISequence..." -> "Begin" sequence" and "..I checked out the custom action RemoveExistingProduct action..." but I can't seem to find how to integrate this behavior even after reading up on custom actions.

I am using v6.0.1, enterprise edition.

I'm not sure this matters, but the application is a .net/csharp application installed on a windows xp machine.
Our automated build system will create many installers during the day, each will have the version number bumped for each subsequent build. As it stands right now, if I run the installer for created by the current build, it tells me that there is a previous version installed on this computer and I must first manually remove it (via control panel). I understand that if I also change the product code each time, then the installer will perform an "upgrade". But it doesn't seem like our continuous integration builds should update the product code each build. Besides, the usage of our product is fine for an install of a new version can automatically remove an old version.

How can I accomplish this behavior with this particular version of AI?

Thanks,
Beth
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Automatically uninstall previous version(s)

Hi Beth,
Our automated build system will create many installers during the day, each will have the version number bumped for each subsequent build. As it stands right now, if I run the installer for created by the current build, it tells me that there is a previous version installed on this computer and I must first manually remove it (via control panel). I understand that if I also change the product code each time, then the installer will perform an "upgrade". But it doesn't seem like our continuous integration builds should update the product code each build.
Unfortunately Windows Installer can perform an automatic upgrade only when the version is increased and the Product Code is changed. This is how MSI major upgrades work. If you don't want to change them, you can try launching the new package using the "Run" button in Advanced Installer. This way Advanced Installer automatically uninstalls the old package before launching the new one.

Another solution is to manually uninstall the old package before launching a new one.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
beth
Posts: 5
Joined: Fri Apr 16, 2010 7:11 pm

Re: Automatically uninstall previous version(s)

Maybe updating the Product Code each time is ok after all.

I will be using the command line feature to edit the version of the software via my automated build. This automatically updates the Product Code for me (at least as long as I update fields 1-3 of the version; updating the fourth field, which is our build number, does not update the Product code). Then our software gets automatically upgraded.

I don't think we necessarily need to "uninstall" the previous version and then "install" the new version. The upgrade feature should be just fine.

Thanks,
Beth
benzene
Posts: 2
Joined: Tue Oct 01, 2013 12:23 am

Re: Automatically uninstall previous version(s)

How would I "manually uninstall the previous version?" I assume you don't mean force the user to go through control panel.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Automatically uninstall previous version(s)

Hello and welcome to Advanced Installer forums,

Thank you for your interest in Advanced Installer.

In order to manually uninstall a package you can uninstall it from Control Panel -> Program and Features applet, you can run its installation package in maintenance mode and use the [Remove] button from "MaintenanceTypeDlg" dialog or you can manually run an uninstall command line like this:

Code: Select all

msiexec.exe /x {ProductCode}
However, if you don't want to automatically uninstall the previous version of your product by changing the ProductVersion, then you can enable the "Uninstall a package with the same version (if found)" option from "Media -> Configuration" tab.

Let us know if this helped, otherwise please give us more details about your scenario.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
benzene
Posts: 2
Joined: Tue Oct 01, 2013 12:23 am

Re: Automatically uninstall previous version(s)

Yes! Thank you! I needed to use the bootstrapper to upgrade files with the same version. Unless you choose to build a .EXE you don't get that option.

Thanks again,
Dave
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Automatically uninstall previous version(s)

Hello Dave,

You're welcome. Indeed, the "Uninstall a package with the same version (if found)" option is available only when you build an EXE package type.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”