I need to install some prerequisites for an app using Inno. I want the prerequisites to only install if the prerequisite does not exist or is an earlier version. I have found some solutions such as. The process is easy, if the Check function of the.NET setup entry of the Files section evaluates to True (FrameworkIsNotInstalled), the entry is processed, which copies the setup binary into the Inno Setup's temporary folder and if that succeeds, the AfterInstall function InstallFramework is.
This question already has an answer here:
I need to install some prerequisites for an app using Inno. I want the prerequisites to only install if the prerequisite does not exist or is an earlier version. I have found some solutions such as:
That does not look like it checks to see if the framework exists already or what version may already be installed.
What is the pattern to use to look for a previously installed version, if it exists then check version and if version is older or does not exist then install?
EricEricThis question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
This a simple answer to head you in one of many possible solutions.
In the testing environment (or in your computer) you install the application and all the required components, so you have them appear in the control panel's Programs and Features
Then you search in the registry for the name that appears in the Programs and Features
You want to find the value DisplayName that contains that name. You'll find it in one key of
HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall, HKEY_LOCAL_MACHINESOFTWAREWOW6432NodeMicrosoftWindowsCurrentVersionUninstall
or
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionUninstall
, depending of the type of installation.
Note: Some components can be hidden from the Programs and Features if the value SystemComponent is 1 in the correspondent key.
Then you can check the registry key existence with something like this in pascal script Fundamentals of nanoelectronics hanson free.
You can call this function inside function PrepareToInstall(var NeedsRestart: Boolean): String; or using check parameters (search in inno setup help)