How to check registered DLLs in WiX
I'm looking for a way to check if certain third party libraries are installed with certain versions. I want to check the registered DLLs and don't know where they were installed in the file system. In this example, I'm pretty sure they have version 1.50 installed:
<Property Id="PRIORGUID">
<RegistrySearch Id="priorguid" Root="HKCR" Key="Prior.Encoders\CLSID" Type="raw"/>
</Property>
<Property Id="PRIORLOCATION">
<RegistrySearch Id="priorlocation" Root="HKCR" Key="CLSID\[PRIORGUID]\InprocServer32" Type="file"/>
</Property>
<Property Id="PRIORVERCHECK">
<DirectorySearch Id="priorversion" Path="[PRIORLOCATION]">
<FileSearch Name="Prior.dll" MinVersion="1.49"/>
</DirectorySearch>
</Property>
<Condition Message="This application requires Prior.">
<![CDATA[Installed OR PRIORVERCHECK]]>
</Condition>
I basically find a library in the registry that points me to a file, and then I go through the version on the filesystem. I don't understand this method. When I use Type = "file", it returns the directory the file is in instead of returning the full path to the file itself. Does it always work like this? It also means that I have to know the name of the base file. If there was a way to split the full path into name and directory, then I could do FileSearch without knowing the basename?
Is my method reliable? Is there a better way to do this? It looks like this will be a common problem. I am using WiX 3.
Thanks.
a source to share
You can keep strings by simply nesting a inside PRIORLOCATION (see WiX documentation ). Sort of:
<RegistrySearch Id="_test" Root="HKLM" Key="Software\MyCompany\MyProgram" name="Executable"Type="file">
<FileSearch Id="_oldexe2" Name="PROGRAM2.EXE" MinSize="200000" MaxSize="4000000" />
</RegistrySearch>
a source to share