1

I create installer for My Application "Demo"(.Net app) using INNO Setup. Install and Uninstall works smooth when without launching our application.

Uninstall not clean everything if Application is launch. Because my application update existing files and creating some files during Launch.

So how can we clean everything after launch also?

My script code available @ script code

Thanks in advance

Satish
  • 391
  • 4
  • 22
  • I tried with [this](http://stackoverflow.com/questions/643547/how-to-configure-inno-setup-to-uninstall-everything) answer. But not resolved – Satish Feb 06 '15 at 09:49
  • You may point specific files to be deleted or general app folder in [`[UninstallDelete]` section](http://www.jrsoftware.org/ishelp/topic_uninstalldeletesection.htm). – RobeN Feb 06 '15 at 10:15
  • Thanks for reply @RobeN. But i already mention `[UninstallDelete] Type: filesandordirs; Name:"{app}\{#MyAppName}";` But not working. The files create by Application within `{#MyAppName}` – Satish Feb 06 '15 at 10:21
  • 1
    Hmm... Your App folder is `{app}` what is equal to `DefaultDirName={pf}\{#MyAppName}\{#MyAppName}`. So you don't have to add additional `{#MyAppName}`. Try `[UninstallDelete] Type: filesandordirs; Name: "{app}\*"` – RobeN Feb 06 '15 at 10:27
  • And if you want to use the `[Code]` section, then you should change `DeleteBitmaps(ExpandConstant('{app}'));` to `DelTree(ExpandConstant('{app}'), False, True, True);` – RobeN Feb 06 '15 at 13:03

1 Answers1

3

You can achieve that in 2 ways.

1st simple, but User will not be informed about deleting new/changed/additional files:

[UninstallDelete]
Type: filesandordirs; Name: "{app}"

{app} expands as a full path to you Application. By default (basing on your snippet) it would be equal to DefaultDirName={pf}\{#MyAppName}\{#MyAppName}.

2nd from your Code snippet with Question MsgBox:

[Code]

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usUninstall then begin
    if MsgBox('Do you want to delete all data files?', mbConfirmation,
        MB_YESNO) = IDYES 
    then begin
      DelTree(ExpandConstant('{app}'), False, True, True);
      //first False makes that the main Directory will not be deleted by function
      //but it will be by the end of Uninstallation
    end;
  end;
end;
RobeN
  • 5,346
  • 1
  • 33
  • 50