I have a .Net WinForms application developed on .Net 4.0. (windows installer package). The application is dependent on SAP crystal report runtime and MS Access runtime. I need to check if these two prerequisites are installed on the user machine, if not then exit the installer with a dialog box saying installation failed due to missing prerequisites.
[Edit] The image below highlights the type of installer project that I'm working on. It is a old legacy application.
[Edit 2] Here I have created "Search Target Machine" and created "Add Registry Search" - "Search for Crystal Report Runtime"
And created a new "Launch Conditions" under "Launch Conditions" called as "CrystalReportRuntimeInstalled". Somehow this condition is always evaluating to false even when the software is installed. What am i doing wrong?
UPDATE, since you want to use WiX:
WiX Quick Start: You can see how to implement launch conditions in WiX by checking out this nice real-world sample by Helge Klein: https://helgeklein.com/blog/2014/09/real-world-example-wix-msi-application-installer/ (WayBack - archived version).
There are more "WiX quick start suggestions" here. That includes more source code sample links and links of all kinds. It is an "ad-hoc answer" - in other words messy - that seems to help in the real-world. I still wonder why, if you can tell me whether that is true or not that would be good.
- Here is a sample of the links from above: From MSI to WiX, Part 3 – Launch Conditions and Application Search (Wayback - Archived Version). Alex Shevchuk.
Quick, inline sample:
<Condition Message="The .NET Framework 2.0 must be installed"> Installed OR NETFRAMEWORK20 </Condition>
LaunchCondition Table: The general mechanism for this is the LaunchCondition table. You add conditions here that must be satisfied (evaluate to true) for the package to allow installation operations (not just fresh install). You can use custom actions to inspect the system and set properties or you can use built-in MSI search mechanisms to set properties. The properties are then used in the condition specified.
LaunchCondition Problems: Conditions can accidentally evaluate to false on maintenance and uninstall operations. This is generally very undesirable. An example is a check for the presence of a runtime that can have been uninstalled manually and hence accidentally made the main MSI fail to uninstall or even upgrade. Example here (please read thoroughly).
Tweak:To ensure LaunchConditions
only apply on fresh install (and major upgrades - which work as fresh installs technically), there is a trick to add "OR Installed"
to the condition you need. Described here. To the Batmobile.
Example: Here is a row from a LaunchCondition table as example (Require .NET version 4.7):
Installed OR DOTNETVERSION471FULL>="#461308", Microsoft .NET Framework 4.7.1 Full package or greater needs to be installed for this installation to continue.
Links: