Search code examples
wixheatwave

Wix toolset: stop installation of msi if exe already exists


We have an exe of our product already installed on some of the client computers and we need to block the installation of the msi if the exe is already present in the clients computer.

I tried creating a custom action and schedule it before the ui sequence because we have support for quite installation without ui. but the custom action wasn't executing and if we schedule it in the ui sequence then the quite installation will install without checking if the exe exists, is there a way to create a launch condition that check if the exe is present or not we also know the path to where the exe will be stored.

Edit:

I tried using FileSearch Element like the following

     <Property Id="MYAPPINSTALLED" Secure="yes" >
         <DirectorySearch Id="CheckFileDir" Path="C:\Program Files (x86)\My App Folder" AssignToProperty="yes">
             <FileSearch Id="CheckFile" Name="app.exe" />
         </DirectorySearch>
     </Property>

along with a Launch condition like following

<Launch Condition="MYAPPINSTALLED" Message="The App is already installed!" />

Solution

  • You can use FileSearch to set a variable and then check that in your launch conditions.