I need to create an install file that will check the registry for the version of another software. Currently I'm commenting and un-commenting lines of code for separate installs. How can I turn the below into an conditional?
<!--<Property Id="ACADREG" Value="ACAD-A001:409" /> Autocad 2012-->
<Property Id="ACADREG" Value="ACAD-A004:409" /> <!--Autocad Arch 2012-->
I also need to obtain which version that is for later in the install.
<Property Id="ACADROAMDIR">
<RegistrySearch Id="ROAMROOTDIR" Root="HKCU" Type="raw" Key="Software\Autodesk\AutoCAD\[ACADVER]\[ACADREG]" Name="RoamableRootFolder" />
</Property>
<Property Id="ACADDIR">
<RegistrySearch Id="AcadLocRegistry" Type="raw" Root="HKLM" Key="SOFTWARE\Autodesk\AutoCAD\[ACADVER]\[ACADREG]" Name="AcadLocation" />
</Property>
Is there a way wiX can set [ACADREG] by reading the registry instead of me setting it like I did above?
You can use a Preprocessor condition:
<?define AutocadSku = "ACAD2012" ?>
<?if $(var.AutocadSku) = "ACAD2012" ?>
<Property Id="ACADREG" Value="ACAD-A001:409" />
<?else?>
<Property Id="ACADREG" Value="ACAD-A004:409" />
<?endif ?>
Or even better, the best practice is searching for both, so later on you could conditionally check for each property's existence or content:
<Property Id="ACADROAMROOTDIR">
<RegistrySearch Id="ROAMROOTDIR" Root="HKCU" Type="raw" Key="Software\Autodesk\AutoCAD\R18.2\ACAD-A001:409" Name="RoamableRootFolder" />
</Property>
<Property Id="ACADROAMARCHROOTDIR">
<RegistrySearch Id="ARCHROAMROOTDIR" Root="HKCU" Type="raw" Key="Software\Autodesk\AutoCAD\R18.2\ACAD-A004:409" Name="RoamableRootFolder" />
</Property>
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