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

Delete old files on an upgrade

Hello,

I have an msi basic project working fine, but when hay create a new msi package, changing just upgrade code I thought that the upgrade will delete old files of my previous installation simply deleting them from "Files and Folder" view ,but not.

How can I tell InstallShield that an upgrade of my application must delete the old files installed by previous installation??

Thankyou
Labels (1)
0 Kudos
(5) Replies
Lurean
Level 8

don't change the upgrade code. change the product code. The upgrade code is what tells Windows Installer Engine that it is the same program.
0 Kudos
salva_shield
Level 3

Thank you for your answer.

I'm already thought about that but the problem is that if i change the product code the installation ask me where I want to install again when I already have my application installed, I want to upgrade the installation deleting obsolete files.


I have created a installscript with this code:

#include "Ifx.h"

export prototype deleteSQLExternos();

function deleteSQLExternos()
// To Do: Declare local variables.
begin
MessageBox ('MSG TEST', INFORMATION);
if (DeleteDir(INSTALLDIR + '\\Fcs\\Externos\\sql',ALLCONTENTS) = 0) then

// Report success.
return TRUE;
//MessageBox ('[INSTALLDIR]\Fcs\Externos\sql' + " was deleted.", INFORMATION);

else
return FALSE;
//MessageBox ("Unable to delete directory.", SEVERE);

endif;



;

// To Do: Write script that will be executed when MyFunction is called.

end;


script compile right and I create a custom sequence to execute it. But installation fails, and log doesnt say anything, what Have I doing wrong????
0 Kudos
Lurean
Level 8

A major upgrade will ask you where you are wanting to install to, It treats it as a reinstall.

Using properties and conditions you can check to see if this is an upgrade or fresh install and skip the dialog that lets them change the install directory and set the appropriate directory to install to based on previous install.

Look through the help files for Upgrades, and usng properties in conditions to see how to do this.
0 Kudos
salva_shield
Level 3

In addition if I change the product code in add/remove programs add a new application with the same name:confused: :confused:
0 Kudos
Lurean
Level 8

you need to add an upgrade item in the upgrades view and you need to make sure the upgrade codes match between the versions or you will get multiple installs.
0 Kudos