Triggering Behavior Only During a First-Time Installation

InstallShield 2022

There may be times when you want certain behavior to occur only during a first-time installation, but not during uninstallation.

Basic MSI Projects

At run time for Basic MSI projects, the same sequences are used for first-time installations and maintenance installations (including uninstallation). There is no separate uninstallation sequence. Therefore, any custom actions that you schedule in the Installation sequences will, by default, run for both installation and uninstallation.

To specify that an action should run only for a first-time installation, you can use the Not Installed condition. The Not Installed condition is appropriate, for example, for a custom action that launches a Readme file for the application being installed.

InstallScript and InstallScript MSI Projects

In InstallScript and InstallScript MSI installations, you can use the MAINTENANCE system variable to determine whether the installation is running in maintenance mode or if it is a first-time installation. The following code sample shows how to use it in your script:

if (!MAINTENANCE) then

    // it is a first-time install

endif;

 

And for reinstall/modify/repair, it's:

 

if (MAINTENANCE) then

    // ...not first-time

endif;

See Also