The root issue is that the RegistrySearch
is in a separate Fragment
that never gets referenced. Because nothing in the Fragment
gets referenced the linker "optimizes away" the contents of the Fragment
and the search is not included in your Bundle
.
Aside: you could argue that the fact that there is a reference to the variable mentioned in the search in the
Condition
that the linker should be able to figure out that the search is necessary. However, that doesn't work out in all cases.
Fortunately, the solution is quite simple! You even have to choose from one of two:
- Move the
RegistrySearch
element to theBundle
element. - Add a
RegistrySearchRef
element in theBundle
element to reference theRegistrySearch
in theFragment
. You will also need to give theRegistrySearch
andId
attribute.
Personally, I like option two and I would probably even move the Condition
into the Fragment
as well to group all that stuff together. Something akin to:
<Bundle ...>
<util:RegistrySearchRef Id='SearchForThirdParty' />
...
</Bundle>
<Fragment>
<util:RegistrySearch
Id='SearchForThirdParty'
Variable="ThirdPartyCOMLibraryInstalled"
Result="exists"
Root="HKLM"
Key="SOFTWARE\Classes\ThirdPartyId.Server\CLSID"/>
<bal:Condition Message="ThirdParty Application COM Library Required. Please (re)install ThirdParty Application and ensure 'Windows API' and '.Net Components' are installed.">ThirdPartyCOMLibraryInstalled</bal:Condition>
</Fragment>
</Wix>
That should do it.