Installation Order

Inno Setup

Installation Order

Once the actual installation process begins, this is the order in which the various installation tasks are performed:

  • [InstallDelete] is processed.
  • The entries in [UninstallDelete] are stored in the uninstall log (which, at this stage, is stored in memory).
  • The application directory is created, if necessary.
  • [Dirs] is processed.
  • A filename for the uninstall log is reserved, if necessary.
  • [Files] is processed. (File registration does not happen yet.)
  • [Icons] is processed.
  • [INI] is processed.
  • [Registry] is processed.
  • Files that needed to be registered are now registered, unless the system needs to be restarted, in which case no files are registered until the system is restarted.
  • The Add/Remove Programs entry for the program is created, if necessary.
  • The entries in [UninstallRun] are stored in the uninstall log.
  • The uninstaller EXE and log are finalized and saved to disk. After this is done, the user is forbidden from cancelling the install, and any subsequent errors will not cause what was installed before to be rolled back.
  • [Run] is processed, except for entries with the postinstall flag, which get processed after the Setup Completed wizard page is shown.
  • If ChangesAssociations was set to yes, file associations are refreshed now.
  • If ChangesEnvironment was set to yes, other applications are notified at this point.

All entries are processed by the installer in the order they appear in a section.

Changes are undone by the uninstaller in the opposite order in which the installer made them. This is because the uninstall log is parsed from end to beginning.

In this example:

[INI]
Filename: "{win}\MYPROG.INI"; Section: "InstallSettings"; Flags: uninsdeletesectionifempty
Filename: "{win}\MYPROG.INI"; Section: "InstallSettings"; Key: "InstallPath"; String: "{app}"; Flags: uninsdeleteentry

the installer will first record the data for first entry's uninsdeletesectionifempty flag in the uninstall log, create the key of the second entry, and then record the data for the uninsdeleteentry flag in the uninstall log. When the program is uninstalled, the uninstaller will first process the uninsdeleteentry flag, deleting the entry, and then the uninsdeletesectionifempty flag, deleting the section.

Note that the uninstaller processes [UninstallRun] and [UninstallDelete] entries in the same order they appear in the script (not in reverse order).