Our app requires a recent version of a DLL in order to function correctly. The path to the DLL is stored in the registry. How do I enforce a minimum file version as a launch condition in Windows Installer?
So far I have this:
<Property Id="FileTest">
<RegistrySearch Id="FileSearch"
Key="SOFTWARE\Company\Product"
Name="DLLPath"
Root="HKLM"
Type="file">
<FileSearch MinVersion="1.2.3.4" />
</RegistrySearch>
</Property>
<Condition Message="!(loc.ErrorMessage)">Installed OR (FileTest)</Condition>
But WiX won’t compile this:
MainApp.wxs(543) : error CNDL0010 : The FileSearch/@Name attribute was not found; it is required.
The problem is I don’t know what to enter for the Name attribute. I don’t know in advance what the DLL is named, it could be anything! (That’s why the registry value is there!!)
What happens if you modify the
RegistrySearchto this:I think having FileSearch as both the ID and an actual wix element is causing you and issue. If you change the id to something like
FileSearchResultand then reference it in theName(or safer,LongName) attribute of theFileSearchelement (by enclosing it in square brackets,[]), then it should work. I haven’t touched wix in about 6 months, so I make no promises 😉NOTE: The square brackets are the way the Wix UtilExtensions (as seen in this example) identify a
RegistrySearchresult stored in thevariableattribute. It may not be so for accessing theIdholding the result in standard wix.NOTE 2: You may actually need to use a
RegistrySearchRefelement as the parent to theFileSearchelement instead. Take a look at this example (though it uses one result of aDirectorySearchelement in anotherDirectorySearch). Hopefully this may give you enough to go on.