I'm trying to do is:
if registrySearch exist then
set INSTALL_DIR to C:\Program Files\MyCompany\MySoftware
else
set INSTALL_DIR to C:\ProgramData\MyCompany\Folder
Anyone know to do this?
Let say this the registry key you searched.
<Property Id="REGSEARCH">
<RegistrySearch Id="TestReg"
Root="HKLM"
Key="Software\TestKey\TestKey2"
Name="Test"
Type="raw" />
</Property>
This is how to set the property conditionally.
Keep the default value as the value you need to put when the registry does not exist.
<Property Id="INSTALL_DIR" Value="C:\ProgramData\MyCompany\Folder" />
Then set the property value as follows if the registry exists.
<SetProperty Id="INSTALL_DIR" After="AppSearch" Value="C:\Program Files\MyCompany\MySoftware" Sequence="first" >
<![CDATA[REGSEARCH]]>
</SetProperty>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With