PDA

View Full Version : How to automatically uninstall a previous version of a application during installing



honery
02-23-2005, 08:45 PM
Hello ,

Who could tell me how to automatically uninstall a previous version of a application during installing the latest version of the same application?

I used InstallShield 10.5 Professional packed 2 versions of my applications (e.g. V1.0 and V2.0) using InstallScript project. Firstly, I installed V1.0 on my host. And then I want to install V2.0 on my host. But I don't want to manually remove the application of V1.0 before I start installing V2.0. But I hope the setup program can help me detect the existence of v1.0 and automatically uninstall it before running the installation. The uninstalling process should be silently done by InstallShield Wizard itself and don’t need any user’s response for confirming. After uninstalling the existed application V1.0, the InstallShiled Wizard is supposed to automatically start installing application V2.0 as well as without any user’s confirmation.

I want to use InstallScript to achieve this goal. In event function OnResumeUIBefore I used Buit-in function UninstallApplication. But it doesn't work at all. Because function UninstallApplication() doesn't support the product GUID of the current setup(i.e. uninstall the same product). Anyway my two InstallShield packed applications both belong to the same product family (both have the same product GUID), but different versions.

Are there some approaches that can achieve the goal described above since I think this requirement is very common for updating installation issues?


Any help will be appreciated.
Thxs,

Honery.

Wincor
02-24-2005, 09:24 AM
Hi,

I had the same problems and (due to a lack of a better way to do) used the following as a work-around:

- deregister the files in self-registering groups (when installing, I write a list to the installation directory with all files being registered by InstallShield)
- delete all directories
- install new version

I know that this is not a clean uninstall, but until today the only way I know to solve the problem of silently uninstalling before installing a newer version.

Ciao
Wincor

honery
02-24-2005, 08:52 PM
Thanks alot. Anyway in such case this is a practical solution.
But when I install v2.0 of my application to a host in which v1.0 existed, the InstallShield Wizard always leads to Resume installation Mode(Update mode).
Do you mean that I should deregister,delete all existent directories and files in event function OnResumeUIBefore and afterward the setup process can successfully complete?

RadhaK
02-25-2005, 01:37 AM
Hi,

When working with InstallScript-based installations, you can update an application with either a full release package or differential release. Various considerations such as file size and the presence of files from any previous release must be considered in determining the best upgrade method.

InstallShield provides two different mechanisms for creating upgrades for InstallScript-based installations:


You can package your upgrade as a full release that updates an existing product if an earlier version is installed, or behaves as a first-time installation if no earlier version is present.
You can package your upgrade as a differential release that contains only the changed data (byte-level file differences) between the versions to be updated.

For step-by-step instructions on how to update an InstallScript-based installation by either creating a differential or full release, consult the "Creating an InstallScript Release to Update Previous Versions" in the Working with Differential and Full Releases section of the help.

Wincor
02-25-2005, 04:19 AM
But when I install v2.0 of my application to a host in which v1.0 existed, the InstallShield Wizard always leads to Resume installation Mode(Update mode).


You can disable in your "General Information" any update or maintenance attempts of Installshield. Just select the proper option in this view.


Do you mean that I should deregister,delete all existent directories and files in event function OnResumeUIBefore and afterward the setup process can successfully complete?

I set a variable to flag that there´s an existing installtion (so I have to perform an uninstall first) and exit the maintenance/update events instantly. I return to the complete install methods and perform a uninstall there.

If you have any further questions, just ask... :)

Annaraj
02-25-2005, 06:39 AM
Honery,

Exactly Same situation came to me also..but for me it's v2.2 to v3.0 of the same product

Here are the things i performed to work fine for me....


But when I install v2.0 of my application to a host in which v1.0 existed, the InstallShield Wizard always leads to Resume installation Mode(Update mode).

1. Went to Releases > Product Configuration 1 in the settings i changed the "Generate Package Code" to "No".. i got rid of the update mode problem.

2. Created new installer for v3.0 (in my case)coz v2.2 is no more. you can also try changing the product GUID..i didn't do it coz that has it's own drawbacks..rather i created a new installer...thats very easy..with the same settings and same install steps for v2.2

3. In OnBegin function, i checked for the older version v2.2 i used registry key for the check and performed the uninstallation(i think if you don't want to use UninstallApplication, try executing the value got from SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\InstallShield_{29B37B00-3AE2-4X17-9972-A6193ED21D59}\\Uninstallstring)


sIVDExeRegistryPath="SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\InstallShield_{29B37B00-3AE2-4X17-9972-A6193ED21D59}";
if (RegDBKeyExist(sIVDExeRegistryPath) = 1) then
nResult = MessageBox( "Previous installation of found. Do you want to upgrade? \nPress Yes to Upgrade, No to abort the setup", MB_YESNO );
if (nResult != IDYES ) then
abort;
else
szUninstallKey = "";
szUninstallKey = "InstallShield_{29B37B00-3AE2-4X17-9972-A6193ED21D59}";
//Specified for silent uninstallation
szAdditionalCmdLine="/uninst";
UninstallApplication ( szUninstallKey, szAdditionalCmdLine, LAAW_OPTION_WAIT|LAAW_OPTION_HIDDEN );
endif;
endif;

4. Continue the actual latest product installation v3.0

Note: The product GUID used in the code above is the previous version's GUID.

This helped me alot and can able to overcome the problem...give a try..trying things are no harm...i hope..

Best of luck,
Anna

honery
02-28-2005, 01:40 AM
Hi Anna,

I'm really appreciate your generous help. But I'm still in trouble to overcome this problem.


you can also try changing the product GUID..i didn't do it coz that has it's own drawbacks..rather i created a new installer...thats very easy..with the same settings and same install steps for v2.2
I think you cannot use Built-in function UninstallApplication since the function don't allow both previous and current setup applications have the same product GUID.



Therefore I want to directly excute the uninstallstring.

3. In OnBegin function, i checked for the older version v2.2 i used registry key for the check and performed the uninstallation(i think if you don't want to use UninstallApplication, try executing the value got from SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\InstallShield_{29B37B00-3AE2-4X17-9972-A6193ED21D59}\\Uninstallstring)

Here's my script:

nIsFlag = FILE_EXISTS;
szApplicationPath="";
PathInUninstallString="C:\\PROGRA~1\\COMMON~1\\INSTAL~1\\Driver\\1050\\INTEL3~1";
szApplicationPath = PathInUninstallString ^ "IDriver.exe";
//To ensure that the path or filename is not enclosed in quotation marks,
LongPathToQuote(szApplicationPath,FALSE);
//Check if the IDriver.exe file exists
if (Is (nIsFlag, szApplicationPath) = TRUE) then

szApplicationPath="";
szApplicationPath = PathInUninstallString ^ "IDriver.exe";
szApplicationCmdLine = "/M"+PRODUCT_GUID;
LongPathToQuote( szApplicationPath, TRUE );
szCmdLine = szApplicationPath + " " + szApplicationCmdLine;
if (LaunchAppAndWait("",szCmdLine,LAAW_OPTION_WAIT) <0) then
MessageBox("Launch failed! ",INFORMATION);
else
MessageBox("Launch succeeded! ",INFORMATION);
endif;

endif;

Unfortunately, the same problem appeared. Also LaunchAppAndWait don't allow to uninstall when both the previous and current applications have the same product GUID. So this failed again.


Thanks&Best regards,

Honery

honery
02-28-2005, 01:44 AM
Hi,

When working with InstallScript-based installations, you can update an application with either a full release package or differential release. Various considerations such as file size and the presence of files from any previous release must be considered in determining the best upgrade method.

InstallShield provides two different mechanisms for creating upgrades for InstallScript-based installations:


You can package your upgrade as a full release that updates an existing product if an earlier version is installed, or behaves as a first-time installation if no earlier version is present.
You can package your upgrade as a differential release that contains only the changed data (byte-level file differences) between the versions to be updated.

For step-by-step instructions on how to update an InstallScript-based installation by either creating a differential or full release, consult the "Creating an InstallScript Release to Update Previous Versions" in the Working with Differential and Full Releases section of the help.
Thanks alot. But my trouble is I have to use a full release package every time.

venkatasundaram
03-24-2005, 03:21 AM
Hi

I am also facing similar problems. I want to uninstall and reinstall the SW in one go. You had mentioned about setting some flag and exiting MaintUI events. How did you made sure that the software continue with the installation?

Regards
Sundar

DevinEllingson
03-24-2005, 05:10 PM
honery,

Here is how I would do this, create a "launcher" install that checks whether the old version is installed and uninstalls it by launching the main setup as appropriate, then after uninstalling the previous version, launches the setup to install the current version.

Devin Ellingson
InstallShield, A Macrovision Company

Gvarma
01-29-2006, 11:50 PM
Where do u check (What event) if the application has been installed, before triggring Uninstallation?

In the installscript project it seems (while debugging) that the installer always executes OnFirstUIBefore() weather you are installing or uninstalling.

Did u create another function to check for the app and called OnFirstUIBefore OR OnUninstall() based on weather application was found ont he target system or not?

TIA

chindi
10-03-2013, 06:08 AM
honery,

Here is how I would do this, create a "launcher" install that checks whether the old version is installed and uninstalls it by launching the main setup as appropriate, then after uninstalling the previous version, launches the setup to install the current version.

Devin Ellingson
InstallShield, A Macrovision Company

Hi Devin,

I would like to try your suggestion. Can you give some details of "create a "launcher" install that checks whether the old version is installed "

I guess do not mean "LaunchApplication" did you ? When I tried this launchApplication with current setup.exe and passing uninstall arguments I got the expected error "Another instance of the setup is running".


I appreciate your response.

Thanks