I'm making an installer with the WiX 3.5 toolset, and I've run across a problem:
The installer needs to be able to detect w开发者_StackOverflow中文版hether another program is present, and if so, add a DLL file in its directory. I use the following code to figure out where the second program is installed:
<Property Id="FIND_INSTALLDIR" Value="[%ProgramFilesFolder]\PROGRAM">
<RegistrySearch
Id="INSTALLDIRSearch"
Root="HKLM"
Name="UninstallString"
Type="file"
Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\PROGRAM"
/>
</Property>
The trouble is, if the second program isn't installed, Windows Installer gives me an error:
Could not access network location [%ProgramFilesFolder]\PROGRAM
I need to be able to handle this gracefully, though... how do I recover from the error?
Perhaps this will help you: Detecting the presence of a directory at install time
Basically, you need to make sure that the property you are using for the DLL folder is set to a valid path, even if the DLL will not be installed (the actual path was not found).
With Cosmin's help, I found the solution:
All I had to do is to not set Value
, so that it wouldn't try to find the folder... everything else worked perfectly!
精彩评论