cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ugurgung
Level 3

Product Upgrade Problem

Hi,

I am trying to upgrade an existing setup with new setup built with InstallShield 2009 but i cannot make setup to upgrade existing installation and need help for this.

I have an old setup project implemented with IS 11 or 12 (dont know). Now i am using IS 2009 and trying to build setup project. As a requirement i need to upgrade existing installation on our customer's computers. So i implemented same setup with InstalScript MSI project type (which has upgrade feature unlike InstallScript project type). When i try to convert project with IS 2009, project is converted to InstallScript type project which doesnot have upgrade feature. I set the product GUID to old product GUID to support upgrade feature in new project.

I thought same product GUID setups would realize they are same product and would try to upgrade but upgrade process doesnot start and setup tries to install from fresh in new setup. I think old installation cannot be detected even if it has same product GUID.

Is there a way to detect old installation and execute upgrade process (either automatically or from script manually)?

Thanks in Advance,

Ugur
Labels (1)
0 Kudos
(3) Replies
irenejia
Level 4

Normally when we say upgrade, we mean major upgrade, that is to say to uninstall old one and reinstall new one. Is this what you mean for upgrade? With this idea, you can detect the old version from registry entry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{your product id}. if this entry exists, the old product has already existed. there is a string value "UninstallString" under this entry, which can be used to launch the uninstallation process.
0 Kudos
ugurgung
Level 3

irenejia wrote:
Normally when we say upgrade, we mean major upgrade, that is to say to uninstall old one and reinstall new one. Is this what you mean for upgrade?


No. With upgrade i mean the "Upgrading Product X from v12 to v14" screen. I think it uninstalls old product and installs new product (default option) in background but shows "Upgrading" dialog.

From v12.0.0.1 to v14.0.0.1 is a major upgrade but also from v14.0.0.1 to v14.0.0.2 should be an upgrade too. As far as i remember if i rebuilt the new setup, it can handle this build version change and starts upgrade process.

irenejia wrote:

With this idea, you can detect the old version from registry entry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{your product id}. if this entry exists, the old product has already existed.


Old setup puts info to that location, yes, it exists. But new setup doesnot or cannot detect this.

irenejia wrote:

there is a string value "UninstallString" under this entry, which can be used to launch the uninstallation process.


I saw now but i need to upgrade in a way, uninstall is not a good solution for me because this string started removal process. I need to start upgrade process.

Thanks,

Ugur
0 Kudos
ugurgung
Level 3

Here is a workaround for my problem if anyone also needs solution.

In "OnFirstUIBefore" function i added below script:


RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
szInstallKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{PRODUCTGUID}";
//: UgurG: uninstall old setup manually if exists
if( !REMOVEONLY ) then
//: UgurG: get existing installation registry key if exists
nResult = RegDBKeyExist( szInstallKey );

//: another installation exists, check its version
if( nResult = 1 ) then
nResult = RegDBGetKeyValueEx( szInstallKey , "Version" , nKeyType , szInstalledVersion , nInstalledVersionLength );
if( nResult = 0 ) then
StrToNum( nVersion, szInstalledVersion);
//: XYZ is version value for version P (0XYZ000000)
//: New setup supports higher versions than 'P', for older versions than 'P' i need to remove them manually on new product installation
if( nVersion >= XYZ ) then
goto Dlg_SdWelcome;
endif;
endif;

//: UgurG: get uninstall command from registry to uninstall old version
nResult = RegDBGetKeyValueEx( szInstallKey , "UninstallString" , nKeyType , szUninstallKey , nUninstallKeyLength );
if( nResult = 0 ) then
//: UgurG: in case of an error check uninstall string length
nResult = StrLength(szUninstallKey);
if( nResult >0 ) then
//: remove first "rundll32" from uninstall string
StrSub( szUninstallArgs, szUninstallKey, 9, StrLength(szUninstallKey) );

//: execute uninstall application
LaunchApplication( "rundll32", szUninstallArgs, "", SW_SHOWNORMAL, LAAW_PARAMETERS.nTimeOut , LAAW_OPTION_WAIT | LAAW_OPTION_SHOW_HOURGLASS | LAAW_OPTION_WAIT_INCL_CHILD | LAAW_OPTION_USE_SHELLEXECUTE);

//: show the actual installation, maybe not needed but couldnot make installation show its window by own.
GetWindowHandle(handle);
ShowWindow(handle, SW_SHOWNORMAL );
endif;
endif;
endif;
endif;

Dlg_SdWelcome:
..........other stuff


Besides this workaround i still need a better solution.

Thanks

Ugur
0 Kudos