2013-03-05 225 views
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,
可以请你告诉我,这有什么错我的条件:wix安装程序3.7引导程序注册表搜索

罗布的回答后
InstallCondition="(NOT MatlabPath) AND (NOT MatlabMCRPath)" 

修复:

DetectCondition="MatlabMCRPathExists OR MatlabPathExists" 

这种情况下应以安装

回答

4

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

该修复可能只是将Matlab ExePackage/@InstallCondition更改为ExePackage/@DetectCondition

+0

谢谢.i已更改为DetectCondition,但它跳过了MatLab MCR的安装。我卸载了MCR并重新启动了我的电脑。这是日志文件:“条件”(不MatlabPath)和(不MatlabMCRPath)“评估为真”。还有“Detected package:MatlabMCR2012a64,state:Present,cached:None”这意味着注册表仍然存在?或者我的代码中有错误? – Gilad 2013-03-05 22:39:19

+0

我已将条件更改为OR,并且这是我得到的条件'MatlabMCRPathExists或MatlabPathExists'的计算结果为false。然而MCR安装 – Gilad 2013-03-05 23:17:57

+0

确定nvm它总是像一个类型。感谢它的修复! – Gilad 2013-03-05 23:29:14

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

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

DetectCondition="(NOT MatlabPathExists) OR (NOT MatlabMCRPathExists)" 
+0

谢谢,我的目标是安装Matlab MCR只有当没有MATLAB或MCR安装。 InstallCondition是否意味着如果找不到其中的一个,则安装MCR? – Gilad 2013-03-05 10:23:05

+0

@Androidy,那么条件检查逻辑需要一些修正。我只在util中使用了正确的变量:RegistrySearch并正确使用了它。然后你的条件检查可以像InstallCondition =“(不MatlabPathExists)和(不MatlabMCRPathExists)”我希望。 – RinoTom 2013-03-05 10:37:05

+0

这是我的情况,它不起作用 – Gilad 2013-03-05 10:42:28

4

这是我的最终和工作代码:
这个代码检查的.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> 
相关问题