A prerequisite is other software that is required for your software to function properly. Sometimes it is best to carry the prerequisite as part of your installation experience. Other times it is better to simply prevent your installation from continuing until the prerequisite is present.
Detect the prerequisite.
Detecting a prerequisite is dependent on the prerequisite manufacturer's design decisions. It is common for a prerequisite to have a registry key to detect the presence of the prerequisite so we will use that in our example.
<Property Id='DetectedPrereq'>
<RegistrySearch Id='SearchForPrereq'
Root='HKLM'
Key='SOFTWARE\Manufacturer\Prerequisite'
Name='Version'
Type='raw'/>
</Property>
The above code looks the prerequisite to have a "Version"
registry value in the registry key "HKLM\SOFTWARE\Manufacturer\Prerequisite"
.
Prevent install when missing prerequisite.
Preventing the install from proceeding is easy with a LaunchCondition
. Simply add a Condition
element anywhere under your Product
element.
<Condition Message="Please install Manufacturer's Prerequisite first.">
DetectedPrereq OR Installed
</Condition>
The expression in the Condition
must evaluate to true for the installation to proceed. In this case, as long as the prerequisite is detected (DetectedPrereq
is not ""
) or the package was already installed, the package is allowed to run. The latter part of the condition is important to allow your package to be removed even when the prerequisite was uninstalled first.
Comments
0 comments
Please sign in to leave a comment.