A customer asked me an interesting question recently. How to create an install condition in a Basic MSI project that is based on whether or not SharePoint is installed on the user's system. A handy way to do this is to use System Search Wizard, so we will look at that.
System Search is under the Behavior and Logic section of the IDE. Click on System Search, right-click in the right pane and select Add. System Search Wizard will open, just click Next and you will be on the "What do you want to find?" page. Select "Registry entry" from the list and click Next.
On the "How do you want to look for it?" page, select HKEY_LOCAL_MACHINE for the Registry Root, enter Microsoft\Shared Tools\Web Server Extensions\12.0 for the Registry Key and enter Version for the Registry Value. then click Next.
On the "What do you want to do with the value?" page, enter WSSVERSION for the property name, and click "Store the value in the property and use the property in an Install Condition". Then click Finish.
At this point, Condition Builder will open. You see, System Search was used to query the Registry entry and put the value in the property, WSSVERSION. Now, Condition Builder will be used to create an Install Condition based on the property.
For the Condition, enter "WSSVERSION <= "12.0.0.0000". For the Message enter, "The proper version of SharePoint is not installed on this machine. The installation program can not continue until the proper version is present". Then click OK.
Next, rebuild the installer and test it out. The installation will only continue if a Sharepoint version greater than 12.0.0.0000 is installed on the machine. Otherwise, a message will be displayed telling the user that it is required, and the installation will end.
There is one more detail worth mentioning. When you create the Install Condition, an entry is added to the LaunchCondition table in the Direct Editor view. So, if you do this procedure a number of times for the same installation, and each time changing the version condition until you get it right, there will be an entry in the LaunchCondition table for each try that you did. For example, if you go to the System Search view, click on the row for the registry search you have been working with, and then click Delete, the entry will be deleted from the System Search view, but the Install Condition will still be in the LaunchCondition table. If it takes you three tries for you to get it right, there will be three entries in the LaunchCondition table. And when you test, who knows what will happen because all these conditions will need to be satisfied. So when you delete the row in the System Search view, go to LaunchCondition and delete the corresponding row. It will save you some aggravation.
That's all there is to creating an Install Condition using System Search and Condition Builder. You can adapt this to any example you like.
You may be wondering why my customer didn't just add a Sharepoint prerequisite to the installation. It's because the requirement he was given was not to install Sharepoint, just to check that the proper version was already installed, and continue the installation only if it was there.