installationwindows-installerinstallshieldinstallshield-2015

How to add a prerequisite check for .NET framework 4.5.2 in InstallShield Basic MSI project


I'm going to install a .NET application through InstallShield. The .NET application targets .NET Framework v4.5.2. So I do not want the installation to proceed if .NET framework v4.5.2 is not found on the computer. I want to detect this dependency as part of prerequisite check-up in the very beginning of the installation. How can I achieve this in InstallShield 2015?

UPDATE: When I tried going via the distributables route as suggested by Shahzad, I faced below error:

Your project contains InstallShield prerequisites. A setup.exe setup launcher is required.

The project I'm working upon is a Basic MSI project. I figured out that the project should create a setup.exe file in the build output to resolve this error. But I'm not seeing any setup.exe tab as suggested here in the official documentation. Where can I see it? May be under Project Assistant tab or Installation Designer tab?


Solution

  • I'm elaborating custom software condition methodology so that it can be helpful for someone if they face any difficulty in doing so. Custom software condition can suffice the need when you just want to check the presence or absence of a registry key.

    In my specific scenario, In addition to check the presence or absence of a registry key I also had to compare the value of the specific registry key against a predefined value (379893). I achieved it in two step process:

    1. Got to Project Assistant tab. Click Installation Requirements link at the bottom.

    2. Now under More Options section in left pane, click Create a custom software condition link.

      enter image description here

    3. Click Next on Welcome to the System Search Wizard screen

      enter image description here

    4. Select Registry Entry on System Search Wizard screen

      enter image description here

    5. Select the registry key path where the version of currently installed .NET Framework is stored. In the Registry Value: (Optional) field type a variable name which will store the value of the key. This variable is used later on while creating a comparison condition to check for exact value of .NET Framework version. This variable gets appended into the list of a property called SecureCustomProperties. You can see this property in Property Manager under Behavior and Logic on Installation Designer tab

      enter image description here

    6. Put the error message which should popup in case the desired .NET Framework version is not installed:

      enter image description here

    7. Install condition thus formed will now be shown in the list with its checkbox checked on the Project Assistant tab.

      enter image description here

    8. Now go to Installation Designer [Tab] -> Behavior and Logic -> System Search. Here you will see a new record which correspond to the software search condition we have created so far. Right click on the row and then click Modify...

      enter image description here

    9. Do not change anything on first two screens of the wizard. On the third screen having title What do you want to do with the value?, select the Store the value in the property and use the property in an Install Condition radio button. Now click Finish.

      enter image description here

    10. Now a new Condition Builder window pops up. Double click Condition column to change it. Change the condition to - DOTNETFRAMEWORKRELEASEVERSIONVALUE >= "#379893"

    enter image description here

    That's it. You're done. Also, if you want you can tweak the condition in point# 10 based on the .NET Framework your application requires to run. More details about condition is available here link.