Search code examples
installationinno-setupuninstallationpascalscript

How to remove the file added by previous version of an application in Inno Setup


I want to uninstall the previously installed application and its associated files and folders before installing the new one.

I referred this solution Detect and uninstall old version of application in Inno Setup using its version number stored in registry – this is working fine, but not removing files and folders which was created by previously installed version.

Example: User has the old version in c:\test\my program and now if he changes the location directly into c. Then it should delete the old files and folders which are present in c:\test. Any way to do that?


Solution

  • If you want your installer to delete additional files, use [InstallDelete] section.


    Obviously better would be if the uninstaller deleted those. So if it is still feasible to fix your uninstaller, use [UninstallDelete] section. Refer to the installation path using the {app} constant.

    [UninstallDelete]
    Type: files; Name: "{app}\MyProgram.ini"