When using Wix you not sure of where a file will be located on the disk.   If this is the case then you need to use DirectorySearch and FileSearch to search for the file.   DirectorySearch  is quite simple you specify the directory that you wish to search and the file that you are trying to find.    A couple of things to point out

  1. Depth on the DirectorySearch element specifies how many sub directories deep you wish to search for the file.  If you only want to search in a specific directory specify a depth of 0. 
  2. MinVersion or MaxVersion can be used to limit the search to a specific file version.

The following is an example that I used to find the location aspnet_regiis for .NET Version 2.   Note:  I also did a RegistrySearch to find out where the .NETFramework was installed. 

 

<Property Id="FRAMEWORKBASEPATH">
<RegistrySearch Id="FindFrameworkDir" 
Root="HKLM"
Key="SOFTWARE\Microsoft\.NETFramework"
Name="InstallRoot" Type="raw" > </RegistrySearch> </Property> <Property Id="ASPNETREGIIS" > <DirectorySearch Path="[FRAMEWORKBASEPATH]"
Depth="4" Id="FindAspNetRegIis"> <FileSearch Name="aspnet_regiis.exe" MinVersion="2.0.5" /> </DirectorySearch> </Property>
Advertisements