user541686
user541686

Reputation: 210485

WiX Property: Directory Search: "Could not access network location"

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 whether 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?

Upvotes: 3

Views: 2875

Answers (2)

user541686
user541686

Reputation: 210485

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!

Upvotes: 1

Cosmin
Cosmin

Reputation: 21416

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).

Upvotes: 2

Related Questions