Checking application prerequisites


(Difference between revisions)
Jump to: navigation, search
Line 26: Line 26:
* [[.NET - Detect framework]]
* [[.NET - Detect framework]]

Revision as of 22:27, 1 December 2008

Checking for external prerequisites

Where your application requires some other component (not included in the setup) to already be installed before installation can proceed, you can do the checking in the InitializeSetup event function:

function IsMyPrerequisiteInstalled(): Boolean;
  Result := {whatever code you need to check whether it's installed or not};

function InitializeSetup(): Boolean;
  Result := True;
  if not IsMyPrerequisiteInstalled() then begin
    MsgBox('MyPrerequisite is not installed.  Installation cannot continue.', mbError, MB_OK);
    Result := False;

Checking for your own application

For partial upgrades or addons (where the main body of your application is not included in the setup), you can use the same pattern as above to check for existence of your own application. Usually the simplest way to do that is to look for its Uninstall entry (as shown in Upgrades; for extra paranoia you could also read out the installation folder and check whether the actual .exe file is there (and what version it is).

Note: when building addon installers, you need to carefully consider what you want the uninstall behaviour to be, which will influence how you choose the AppId for the addon.

See also

Personal tools