1

Currently i have used the following code to delete the old version directory of my application, below code works fine by finding the application with the app name. I want to find the application using it UNIQUE APPID, Can someone please help me out regarding this issue.

procedure DeleteExistingVersion(); begin   
MsgBox('Deletion Starts',mbInformation, MB_OK);

if (DirExists (ExpandConstant('{pf}\APPLICATION NAME'))) then  
begin

DelTree(ExpandConstant('{pf}\APPLICATION NAME'), True, True, True);
MsgBox('Deletion Ends', mbInformation, MB_OK);   
end; 
end;
Santhosh
  • 13
  • 3
  • 1
    You could call `{uninstallexe}` of previous version - example [here](http://stackoverflow.com/questions/2000296/innosetup-how-to-automatically-uninstall-previous-installed-version) and even better one [here](http://stackoverflow.com/questions/11739317/how-to-detect-old-installation-and-offer-removal) – RobeN Aug 22 '13 at 08:14
  • 1
    You should uninstall it. Not just delete the folder tree. – TLama Aug 22 '13 at 08:15
  • 1
    Thanks for your valuable comments @RobeN,TLama [this](http://stackoverflow.com/questions/2000296/innosetup-how-to-automatically-uninstall-previous-installed-version) helps me to solve this issue. Now my apllication uninstalls existing version completely before installing new version. – Santhosh Aug 22 '13 at 11:48

1 Answers1

0

The best way is to uninstall previous version of your app instead of just deleting the tree by calling {uninstallexe}. You can check two solutions that were posted earlier:

InnoSetup: How to automatically uninstall previous installed version?

How to detect old installation and offer removal?

Community
  • 1
  • 1
RobeN
  • 5,346
  • 1
  • 33
  • 50
  • Note that unless there is some special reason there is no need to uninstall your application before upgrading it with a later build of the installer. – Miral Aug 22 '13 at 20:44