2014-10-09 50 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创建单独的文件。
可能为他们创建单独的片段也应该工作,虽然我还没有尝试过。
其余的代码是相同的。