Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WIX: How to detect if third-party application is installed without using registry search?

I'm trying to create installer using WiX. My problems is that I have to install a third party software only if it is not already installed or its version is older than the current version of the included one. See my example below. Also It would be great if you give me some suggestions for this third party software. How to prevent uninstalling it if it is used by another program or just keep it permanent?

I prefer not to use registry search. This software I'm trying to add is Dokan driver.

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"
     xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
    <Bundle Name="MyApp" Version="1.2.0.0" Manufacturer="Me" 
      UpgradeCode="{GUID}" IconSourceFile="..\icon.ico">
    <BootstrapperApplicationRef 
      Id="WixStandardBootstrapperApplication.RtfLicense" >
      <bal:WixStandardBootstrapperApplication
        LogoFile="..\lo64.png" LicenseFile="License.rtf"/>
    </BootstrapperApplicationRef>
      <Chain>
        <PackageGroupRef Id="NetFx45Web"/>
        <ExePackage 
          SourceFile="..\ThirdPartySoftware_0.6.0.exe" 
          Permanent="yes" 
          InstallCondition="NOT Installed"/>
        <MsiPackage SourceFile="..\MyApp.msi"/>
      </Chain>
    </Bundle>
</Wix>

With this edit I now have installer that checks if Dokan is installed and if not installs it.

I tried checking version but the file is not versioned and it gives me NULL exception.

<util:FileSearch
      Id="CheckDokan"
      Path="[ProgramFilesFolder]Dokan\DokanLibrary\dokanctl.exe"
      Variable="Dokan"
      Result="exists"/>
<Chain>
  <PackageGroupRef Id="NetFx45Web"/>
  <ExePackage
        SourceFile="Dokan.exe"
        Permanent="yes"
        InstallCommand="/q" 
        DetectCondition='Dokan'/>
   <MsiPackage SourceFile="MyApp.msi"/>
</Chain>

I could say that @Yawar helped me.

like image 350
Daniel Filipov Avatar asked May 27 '14 09:05

Daniel Filipov


1 Answers

Approach 1

You can use file search

<util:FileSearch  
Id="CheckFile"
Path="[CommonAppDataFolder]thirdpartapp\thirdparty.dll"
Variable="THIRDPARTYFILE" 
Result="version" /> 

You can check Adobe Air by the following way

<util:FileSearch  
Id="CheckAir"
Path="[CommonFilesFolder]\Adobe AIR\Versions\1.0\Adobe AIR.dll"
Variable="ADOBEAIRFILE" 
Result="version" />

And then use this variable in detect condition like

DetectCondition='NOT Installed AND ADOBEAIRFILE>=v2.6.0'

I hope it will help you :)

Approach 2:

Use this if version not found

<util:FileSearch  
Id="CheckFile"
Path="[CommonAppDataFolder]thirdpartapp\thirdparty.dll"
Variable="THIRDPARTYFILE" 
Result="exists" /> 

and then modify detect condition

DetectCondition='THIRDPARTYFILE'

For further details please follow the documentation.. http://wixtoolset.org/documentation/manual/v3/xsd/util/filesearch.html

like image 148
Yawar Avatar answered Oct 06 '22 17:10

Yawar