Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wix installer 3.7 bootstrapper Registry search

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
     xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
     xmlns:netfx='http://schemas.microsoft.com/wix/NetFxExtension'>

    <Bundle Name="IPDev" Version="0.6" Manufacturer="MYAPP Corporation" UpgradeCode="f380ae43-5df1-4cfe-9297-526e3e638e57">
        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
        <Chain>
            <!-- TODO: Define the list of chained packages. -->
            <PackageGroupRef Id="Netfx45FullPackage"/>      
        </Chain>
    </Bundle>
  <Fragment>
    <!--checking for matlab 2012a installation-->
     <util:RegistrySearch Id="MatlabPath"
            Variable="UniqueId"
            Root="HKLM"
            Key="SOFTWARE\MathWorks\MATLAB\4.17\"
            Result="exists"
            Win64="yes" 
           />
    <!--checking for matlab MCR 2012a 64 bit installation-->
    <util:RegistrySearch Id="MatlabMCRPath"
            Variable="UniqueId"
            Root="HKLM"
            Key="SOFTWARE\MathWorks\MATLAB Compiler Runtime\7.17\"
            Result="exists"
            Win64="yes" 
            />
    <PackageGroup Id="Netfx45FullPackage">

     <ExePackage Id="Netfx45Xxx" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="no" InstallCommand="/q"
        SourceFile="..\SetupProject\dotnetfx45_full_x86_x64.exe"
        DetectCondition="(Netfx4FullVersion=&quot;4.5.50709&quot;) AND (NOT VersionNT64 OR (Netfx4x64FullVersion=&quot;4.5.50709&quot;))"
        InstallCondition="(VersionNT >= v6.0 OR VersionNT64 >= v6.0) AND (NOT (Netfx4FullVersion=&quot;4.5.50709&quot; OR Netfx4x64FullVersion=&quot;4.5.50709&quot;))"/>
     <ExePackage Id="MatlabMCR2012a64" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="no" InstallCommand="/q"
        SourceFile="..\SetupProject\MCR_R2012a_win64_installer.exe"
        InstallCondition="(NOT MatlabPath) OR (NOT MatlabMCRPath)"/>
    <MsiPackage  Id="IPDev" Cache="no" Compressed="no"  DisplayInternalUI="yes" Vital="yes" SourceFile="..\SetupProject\bin\Release\IPDevSetup.msi"/>   

    </PackageGroup>
  </Fragment>
</Wix>

here's my code: my problem is that .NET4.5 is installed only if it exists.
however MATLAB's MCR is installed whether it exists or not.
can you please tell me what's wrong with my condition:

 InstallCondition="(NOT MatlabPath) AND (NOT MatlabMCRPath)"

fix after Rob's answer:

DetectCondition="MatlabMCRPathExists OR MatlabPathExists"

this condition should be false in order to install

like image 861
Gilad Avatar asked Mar 05 '13 08:03

Gilad


2 Answers

Here is my final and working code:
this code check's for .NET 4.5 installation. and for Matlab R2012a or Matlab MCR R2012a.

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
     xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
     xmlns:netfx='http://schemas.microsoft.com/wix/NetFxExtension'>

    <Bundle Name="IPDev" Version="0.6" Manufacturer="Intel Corporation" UpgradeCode="f380ae43-5df1-4cfe-9297-526e3e638e57">

        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
        <Chain>

            <!-- TODO: Define the list of chained packages. -->
            <PackageGroupRef Id="Netfx45FullPackage"/>      
        </Chain>
    </Bundle>
  <Fragment>

      <!--checking for matlab 2012a installation-->
    <util:RegistrySearch Id="MatlabPath"
           Variable="MatlabPathExists"
           Root="HKLM"
           Key="SOFTWARE\MathWorks\MATLAB\4.17"
           Result="exists"
           Win64="yes" />
    <!--checking for matlab MCR 2012a 64 bit installation-->
    <util:RegistrySearch Id="MatlabMCRPath"
            Variable="MatlabMCRPathExists"
            Root="HKLM"
            Key="SOFTWARE\MathWorks\MATLAB Compiler Runtime\7.17"
            Result="exists"
            Win64="yes"  />
    <PackageGroup Id="Netfx45FullPackage">


     <ExePackage Id="Netfx45Xxx" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="no" InstallCommand="/q"
        SourceFile="..\SetupProject\dotnetfx45_full_x86_x64.exe"
        DetectCondition="(Netfx4FullVersion=&quot;4.5.50709&quot;) AND (NOT VersionNT64 OR (Netfx4x64FullVersion=&quot;4.5.50709&quot;))"
        InstallCondition="(VersionNT >= v6.0 OR VersionNT64 >= v6.0) AND (NOT (Netfx4FullVersion=&quot;4.5.50709&quot; OR Netfx4x64FullVersion=&quot;4.5.50709&quot;))"/>
     <ExePackage Id="MatlabMCR2012a64" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="no" InstallCommand="/q"
        SourceFile="..\SetupProject\MCR_R2012a_win64_installer.exe"
        DetectCondition="MatlabMCRPathExists OR MatlabPathExists"/>
    <MsiPackage  Id="IPDev" Cache="no" Compressed="no"  DisplayInternalUI="yes" Vital="yes" SourceFile="..\SetupProject\bin\Release\IPDevSetup.msi"/>   

    </PackageGroup>
  </Fragment>
</Wix>
like image 107
Gilad Avatar answered Sep 24 '22 18:09

Gilad


The InstallCondition attribute is used to determine whether a package should be installed on the machine. If true, the package is allowed to install. If false, the package is uninstalled. What you want is a DetectCondition attribute to determine whether the package is already present on the machine.

The fix is probably just to change the Matlab ExePackage/@InstallCondition to a ExePackage/@DetectCondition.

like image 37
Rob Mensching Avatar answered Sep 23 '22 18:09

Rob Mensching