mossi
Posts: 12
Joined: Thu Oct 09, 2008 9:55 am

How to uninstall similar products during/before install

Hi,

I have an AI project for a hardware driver installer. Works fine.
It shall replace installer(s) based on InstallShield and NSIS.
In order to smoothly introduce AI I need to be able to "cross update" the driver.

Using the "Search" mechanism I look for the UninstallString of the older installers in the registry.
Properties: NSIS_MP and IS_MP32, IS_MP64.
Works fine. If such a package is found I need to uninstall it before installing the new driver.

In the Sequence of Custom Actions I put the CAs into InstallExecuteSequence | RemoveExistingProducts
Custom action: EXE with working dir,
"[NSIS_MP]" /S /UPDATE
with the condition NSIS_MP <> "" works fine although installation process continues.
Similar custom action: EXE with working dir,
"[IS_MP32]" /qn
with the condition IS_MP32 <> "" fails, although a logfile tells me that the action REMOVE_IS_MP has returned 1.
Invoking the uninstallstring in a cmd works fine. (UninstallString = MSIEXEC /X{<GUID>})
I suppose that the implicit MSIEXEC of the uninstallstring just returns immediately and quietly (without error) and does not wait until the former installer has been uninstalled.
I tried to change the custom action to
"[SystemFolder]cmd.exe /C "START WAIT [IS_MP32] /qn /l* [APPDIR]remove.log"
only opens MSIEXEC's help window, (==> something wrong with the call") but does not let me see the orignal command line.
Of course ALL these Custom Actions are of type "Synchronous, ignore exit code".

SO: HOW can I safely remove a package from within an installer?? Means process has to wait until uninstall has finished.

Any help appreciated.

Axel Mock
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: How to uninstall similar products during/before install

Hi Axel,

It seems that the InstallShield package uses Windows Installer. Since two install processes cannot run at the same time, the InstallShield package cannot be uninstalled when your package runs (in "InstallExecuteSequence"). A solution for this would be to schedule the custom actions in "InstallUISequence". This way, the old packages will be uninstalled before your package installation runs. For example, you can schedule the custom actions under "InstallUISequence" -> "FindRelatedProducts".

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mossi
Posts: 12
Joined: Thu Oct 09, 2008 9:55 am

Re: How to uninstall similar products during/before install

Hi Cosmin.

thanks for the prompt reply.
Yeah, of course, the second MSI....
So, I suppose when moving the Custom Action to the InstallUI Sequence it won't be scheduled if the installer runs in silent mode.
Right?

Then I should block the installation until the old package has been uninstalled.

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

Re: How to uninstall similar products during/before install

Hi Axel,
I suppose when moving the Custom Action to the InstallUI Sequence it won't be scheduled if the installer runs in silent mode.
Yes, this is true.
Then I should block the installation until the old package has been uninstalled.
This can be done by using a custom launch condition. For example, you can use a search to find out if the old package is installed. The property of this search can then be used for the custom launch condition.

Another solution would be to schedule the uninstall custom action under "InstallExecuteSequence" -> "InstallFinalize" with the "Asynchronous execution, do not wait for return" option. This way, the old product will be uninstalled after the new one is installed.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”