I want my install to fail if a third-party software element is not installed. I added a Fragment
with a util:RegistrySearch
and a bal:Conditi
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:
RegistrySearch
element to the Bundle
element.RegistrySearchRef
element in the Bundle
element to reference the RegistrySearch
in the Fragment
. You will also need to give the RegistrySearch
and Id
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.