How to use launch condition option in installation package using C#
-
19-08-2019 - |
Question
I want my application to check (before start installation) for Nokia_PC_Suite_rel_7_0_8_2 my steps are :
1) I added Registry Search and it's properties are
Property = PCSUITERUNTIMEEXISTS, RegKey = HKEY_LOCAL_MACHINE\SOFTWARE\PCSuite\Product, Root= vsdrrHKLM, Value = Nokia Pc Suite
NOTE: I got the value of Value
property from the registry editor were i double-clicked on PCSiute then I found Product when I clicked on it I found a dialogue with 2 texts:
- Value name
- Value data
2) I added new Launch condition called "PCSuite Runtime installed, if not prompt user" and its properties are :
condition = PCSUITERUNTIMEEXISTS //(it's a drop down list so I selected the condition I created in "Registry Search"),
Messege = [ProductName] requires Nokia_PC_Suite_rel_7_0_8_2 runtime.
Please run setup.exe to install the prerequisites for this application.
Now in setup.exe I added Nokia_PC_Suite_rel_7_0_8_2.exe as a pre-requisites so when the user double-clicked on setup.exe he will ask him to install Nokia_PC_Suite_rel_7_0_8_2 if he cancelled the whole installation will stop.
What really happens is that when I click on .msi file is always displays the message ("[ProductName] requires Nokia_PC_Suite_rel_7_0_8_2 runtime. Please run setup.exe to install the prerequisites for this application.") although there is PCSuite Version installed on my PC.
So what to do? I want him to continue the installation if he found PCSuite if not display the message so the user will go to setup.exe. Also when I un-installed PCSuite and clicked onsetup.exe it started installing PCSuite and when he finished he displayed the previous message and quit from the installation.
Solution
A quick test revealed that you need to omit the HKEY_LOCAL_MACHINE\ from the RegKey. So your search Registry Key would look like:
Property: PCSUITERUNTIMEEXISTS
RegKey: SOFTWARE\PCSuite\Product
Root: vsdrrHKLM
Value: Nokia Pc Suite
Nokia Pc Suite needs to be a value (not a Key) that has data. I noticed in my testing just having a Value in the Registry Key that has no data the check will still fail.
If you are just trying to check for the existence of a KEY leave the value blank.