Pascal Scripting: Uninstall Code

The Pascal script can also contain code invoked at uninstall time. See the Event Functions topic for more information.

There is one thing that's important to be aware of when designing code to be executed at uninstall time: In cases where multiple versions of an application are installed over each other, only one Pascal script is run at uninstall time. Ordinarily, the script from the most recent install will be chosen. If, however, you were to downgrade your version of Inno Setup in a new version of your application, the script from the install built with the most recent Inno Setup version may be chosen instead. A similar situation can occur if a user installs an older version of your application over a newer one.

When producing an installation that is a "patch" for another install, and the patch install shares the same uninstall log as the original install (i.e. Uninstallable is set to yes and AppId is the set the same as the original install), make sure the patch includes a copy of the full [Code] section from the original install. Otherwise, no code would be run at uninstall time.

If, however, the patch install has Uninstallable set to no then Setup will not touch the existing uninstaller EXE or uninstall log; in this case, the patch install need not contain a copy of the [Code] section from the original install.