It's been a while since I've done any WiX, but just found out that a bit of an existing bootstrapper exe I wrote ages ago, isn't actually doing what I thought it was - doh !! I've seen other people with similar issues, but I still can't figure out why it's not working.
I'm basically trying to determine if a particular version of SQL SMO is installed and am looking in the registry at this location:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\SharedManagementObjects\CurrentVersion
where there is a REG_SZ key called "Version" and it's set to something like 13.0.1601.5
Below is a mock-up of my code:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Bundle Name="RegReadTesterSetup" Version="1.0.0.0" Manufacturer="BigChris Inc" UpgradeCode="fcaa47db-3b55-474f-995d-2b0a0905fced">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<util:RegistrySearch Id="IsSMOInstalled"
Root="HKLM"
Key="SOFTWARE\Microsoft\Microsoft SQL Server\SharedManagementObjects\CurrentVersion\Version"
Value="13.0.1601.5"
Win64="yes"
Result="exists"
Format="raw"
Variable="SMOInstalled"/>
<Chain>
<MsiPackage SourceFile="C:\Users\chris.moxon\AppData\Local\Temporary Projects\SimpleTextFileSetup\bin\Debug\SimpleTextFileSetup.msi"
Id="MYTEXT"
DisplayName="Big Chris Test File"
Visible="yes"
InstallCondition="SMOInstalled = 0"
SuppressSignatureVerification="yes"/>
</Chain>
</Bundle>
</Wix>
Note : The indented settings (Win64 & Format) are just some of my clutching at straws attempts to get it to work; but with or without these settings; run on a 64bit or 32bit machine, I always get (on machine's where this key does exist !):
Registry key not found. Key = 'SOFTWARE\Microsoft\Microsoft SQL Server\SharedManagementObjects\CurrentVersion\Version'
Setting numeric variable 'SMOInstalled' to value 0
in my log file; so the end result is that the SMOInstalled variable always gets to set to 0 and thus SMO ( or my text file ) is always installed.
I appreciate (or hope) that I must be doing something silly - but alas I have no idea what !!
Thanks in advance,
Big Chris.