2014-07-21 47 views
0

我想在我的MSI安裝程序中包含VC++ Redistributable 2013先決條件安裝。WiX - 如何將ExePackage元素鏈接到產品

我已經修改了Fragmentthis guy執行註冊表檢查後,悄悄地下載和安裝,選擇vcredist_x64.exe包(文件 - MyWixProject/vcredist.wixobj):

<?xml version="1.0" encoding="UTF-8"?> 
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> 
    <?define vcredist_x86="http://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x86.exe"?> 

    <Fragment> 
     <util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\DevDiv\vc\Servicing\12.0\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\vc\Servicing\12.0\RuntimeMinimum" Value="Install" Variable="vcredist" /> 
     <PackageGroup Id="vcredist"> 
      <PackageGroupRef Id="InstallVCRedist"/> 
      <ExePackage Id="vcredist_x86" 
         Cache="no" 
         Compressed="no" 
         PerMachine="yes" 
         Permanent="yes" 
         Vital="yes" 
         Name="Redist\vcredist_x86.exe" 
         SourceFile="Redist\vcredist_x86.exe" 
         DownloadUrl="$(var.vcredist_x86)" 
         InstallCommand="/q" 
         DetectCondition="vcredist AND (vcredist &gt;= 1)"> 
       <ExitCode Value ="3010" Behavior="forceReboot" /> 
      </ExePackage> 
     </PackageGroup> 
    </Fragment> 
</Wix> 

我想引用此Fragment來自我的Product元素(文件MyWixProject/Product.wxs)。我讀到「The contents of a Fragment element can be linked into a product by utilizing one of the many *Ref elements」。但是,ExePackage或其PackageGroupRef如何能夠從主要Product元素引用?或者是有另一種方式從.wxsProduct?>

回答

1

ExePackage內編譯.wixobj及其Fragment只能以捆綁,而不是一個產品。 MSI不支持同時安裝多個產品,而VC++可再發行組件只是一個包含多個產品的Bundle。

+0

那麼,我應該創建一個運行VC++可再發行的Bundle,然後是我的Package? – Elist

+0

對。如果您有多個軟件包,則需要軟件包。 –

+0

或者您可以將C++ redist作爲合併模塊添加:http://wixtoolset.org/documentation/manual/v3/howtos/redistributables_and_install_checks/install_vcredist.html –