george
george

Reputation: 11

How can I uninstall an old version after changing the upgrade code?

I have 2 programs(A and B) with the same upgrade code - when one is installing the other one is uninstalled. Now I have to install both programs on the same machine, in order to do that I changed the upgrade code from one program(A) My problem is that if I already have an old version of A installed on my pc MSI doesn't recognize the new upgrade code and makes a new install. How can I uninstall the old version? Is there a way to do that from installShield? I tried to make a custom script :

    LAAW_SHELLEXECUTEVERB = "runas";
    MessageBox("result incercam uninstall",INFORMATION);
    command_e = "wmic product where \"description='IP Office Admin Lite'\"  uninstall";
    LaunchApplication( "cmd.exe",
     "/C " + command_e,
      "", 
                    SW_MINIMIZE, 0, LAAW_OPTION_WAIT );

But somehow it doesn't work everytime, I think is has something to do with timing. What do you think?

Upvotes: 1

Views: 772

Answers (1)

Stein Åsmul
Stein Åsmul

Reputation: 42246

Upgrade Table: Provided this is an MSI - which it should be since you mention upgrade code - you can generally uninstall any existing installation by means of authoring the upgrade table of the MSI you are installing.

In fact this is the way you should do it, and not rely on any custom action constructs since they tend to cause problems. This is MSI's built in "major upgrade" feature intended to deliver upgrades for your own products

Please see the technical explanations here:

In Installshield you should just add the older upgrade code in the Upgrades view (Installshield help file), but I don't have Installshield available to try it at the moment. The linked answers with WiX constructs should show the overall procedure.

Upvotes: 2

Related Questions