WiX Check File Exists before Install

Viewed 13228

I have seen this question asked many times but none of the answers seem to work for me. I'm obviously missing something elementary, but I can't seem to find out what it is! I've only been using WiX for a couple of days so I'm still very new to it.

Basically, I've built a plug in to an existing product, and I want to check that the product is installed before allowing my plug in to install. I think the simplest way is to check the main executable is in the correct directory.

My relevant code so far:

<Property Id="FILEEXISTS">
  <DirectorySearch Id="CheckFileDir" Path="INSTALLDIR" Depth="0">
    <FileSearch Id="CheckFile" Name="main.exe" />
  </DirectorySearch>
</Property>

<Condition Message="File does exist.">NOT FILEEXISTS</Condition>

Where INSTALLDIR is the Id of the directory where the main.exe should be and is defined in the nested Directory tags.

2 Answers
Related