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

这是我的代码:我的问题是 .NET4.5 仅在存在时才安装。
但是,无论是否存在 MATLAB 的 MCR 都已安装。
你能告诉我我的情况有什么问题吗:

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

在 Rob 的回答之后修复:

DetectCondition="MatlabMCRPathExists OR MatlabPathExists"

这个条件应该是假的才能安装

4

3 回答 3

5

这是我的最终和工作代码:
此代码检查用于 .NET 4.5 安装。对于 Matlab R2012a 或 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>
于 2013-03-05T23:31:44.623 回答
4

InstallCondition属性用于确定是否应在机器上安装软件包。如果为 true,则允许安装该软件包。如果为 false,则卸载包。你想要的是一个DetectCondition属性来确定包是否已经存在于机器上。

修复可能只是将 Matlab 更改ExePackage/@InstallConditionExePackage/@DetectCondition.

于 2013-03-05T22:00:06.707 回答
3

您可以更正您的 RegistrySearch 调用,如下所示:

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

此搜索将搜索结果设置为变量MatlabPathExistsand MatlabMCRPathExists
那么你的条件检查应该如下使用这些变量:

DetectCondition="(NOT MatlabPathExists) OR (NOT MatlabMCRPathExists)"
于 2013-03-05T09:58:42.930 回答