I'm trying to search the registry in my Bootstrapper Bundle file to check if a program is firstly installed and a second search to check the bitness of the program installed.
Then I want to use the values returned to either install a 32bit or 64bit driver for the program.
The issue is that in the log file created when I run this in cmd: Bootstrapper.exe -l "c:\temp\LogFileName.log", I get this line:
[52BC:4F84][2023-05-17T12:59:37]i000: Registry value not found. Key = 'SOFTWARE\[COMPANY_NAME]\', Value = 'Bitness'
I added Bitness as a string value into the registry editor and put the value as 64 as the program is indeed 64bit.
These are my registry searches:
<!-- Check if program is installed -->
<util:RegistrySearch Id="CheckProgramInstalled"
Root="HKLM"
Key="SOFTWARE\[COMPANY_NAME]\[PRODUCTNAME]"
Result="exists"
Variable="ProgramInstalled" />
<!-- Check bitness of the program -->
<util:RegistrySearch Id="CheckProgramBitness"
After="CheckProgramInstalled"
Root="HKLM"
Key="SOFTWARE\[COMPANY_NAME]\[PRODUCTNAME]"
Value="Bitness"
Result="value"
Variable="ProgramBitness" />
It looks like there are at least two separate issues here.
Unrecognised / empty properties
Your registry search includes this key:
Key="SOFTWARE\[COMPANY_NAME]\[PRODUCTNAME]"
but the error message reports the key like this:
Key = 'SOFTWARE\[COMPANY_NAME]\'
This suggests:
[COMPANY_NAME]
property is not recognised (are you sure the underscore is correct?);[PRODUCTNAME]
property is empty.You could check whether these properties are being set correctly, or consider using WiX variables instead - this article might help.
Bitness-specific registry views
By default, <util:RegistrySearch>
searches the 32-bit registry view. This is critical in your case because if you have the 64-bit application installed then your registry search won't find the relevant keys. For more information on registry redirection, see this Microsoft article.
To search the 64-bit registry view, you will need to set Win64="yes"
. See the accepted answers and comments here and here.