2014-10-09 80 views
0

我有兩個產品Product1 & Product2。 Product1使用p1.dll &產品2使用p2.dll。
我已經爲它們定義了獨立的ComponentGroups,但是在同一個wxs文件(Groups.wxs)中。
我已將這些組件組包含在單獨的功能F1 & F2(Feature.wxs)中。
然後爲Product1.wxs中的F1和Product2.wxs中的F2提供FeatureRef,如下所示。
在我的構建系統中,我在bin文件夾中有p1.dll或p2.dll。
當我構建Product1的安裝程序時,我的bin文件夾中只有p1.dll。
然而,當我建立產品1的安裝程序,它拋出 - 錯誤LGHT0103:系統無法找到文件「.. \ BIN \ p2.dll」如何有選擇地包含Wix Features

爲什麼要威克斯鏈接查找p2.dll當我Product1中沒有提供F2的FeatureRef?
我該如何解決這個問題?

Groups.wxs: 
    <ComponentGroup Id="G1"> 
     <Component Id="C1" DiskId="1" Directory="BIN" Guid="xxxx"> 
      <File Id="C1" Name="p1.dll" Source="..\bin\p1.dll" /> 
     </Component> 
    </ComponentGroup> 

    <ComponentGroup Id="G2"> 
     <Component Id="C2" DiskId="1" Directory="BIN" Guid="yyyy"> 
      <File Id="C2" Name="p2.dll" Source="..\bin\p2.dll" /> 
     </Component> 
    </ComponentGroup> 

Features.wxs: 
    <Feature Id="F1" Title="Feature1" Level="1"> 
     <ComponentGroupRef Id="G1" /> 
    </Feature> 

    <Feature Id="F2" Title="Feature2" Level="1"> 
     <ComponentGroupRef Id="G2" /> 
    </Feature> 

Product1.wxs: 
    <FeatureRef Id="F1" /> 

Product2.wxs: 
    <FeatureRef Id="F2" /> 

Product1.wixproj 
    <ItemGroup> 
     <WixCode Include="$(WixCodeDir)\Groups.wxs" /> 
     <WixCode Include="$(WixCodeDir)\Features.wxs" /> 
     <WixCode Include="$(WixCodeDir)\Product1.wxs" /> 
    </ItemGroup> 

Product2.wixproj 
    <ItemGroup> 
     <WixCode Include="$(WixCodeDir)\Groups.wxs" /> 
     <WixCode Include="$(WixCodeDir)\Features.wxs" /> 
     <WixCode Include="$(WixCodeDir)\Product2.wxs" /> 
    </ItemGroup> 

回答

0

最後我可以找到解決方案。我已經將ComponentGroups G1和G2包含在同一個片段中。所以,即使我只在產品中包含G1,G2也會被包括在內。將它們添加到單獨的片段後,問題得到解決。

以下是示例代碼。

<Fragment> 
    <ComponentGroup Id="G1"> 
     <Component Id="C1" DiskId="1" Directory="BIN" Guid="xxxx"> 
      <File Id="C1" Name="p1.dll" Source="..\bin\p1.dll" /> 
     </Component> 
    </ComponentGroup> 
</Fragment> 

<Fragment> 
    <ComponentGroup Id="G2"> 
     <Component Id="C2" DiskId="1" Directory="BIN" Guid="yyyy"> 
      <File Id="C2" Name="p2.dll" Source="..\bin\p2.dll" /> 
     </Component> 
    </ComponentGroup> 
</Fragment> 

然後,我不得不爲功能F1和F2創建單獨的文件。
可能爲他們創建單獨的片段也應該工作,雖然我還沒有嘗試過。
其餘的代碼是相同的。