2016-05-13 7 views
1

1つのフィーチャだけを含むMSIパッケージを生成したい。wxiのWIXフィーチャエレメントと同じIDを持つwxsを使用

私は自動的に生成されるwxiファイルを持っています。私はこのプロセスを変更することはできません。

wxiファイルのようになります。私は変更することができWXSファイル持って

<?xml version="1.0" encoding="UTF-8" ?> 
<Include> 
<!-- components --> 
<Feature Id="DefaultFeature" Title="Main Feature" Level="1"> 
    <ComponentRef Id="comp0" /> 
    <ComponentRef Id="comp1" /> 
    <ComponentRef Id="comp2" /> 
    <ComponentRef Id="comp3" /> 
    <ComponentRef Id="CleanupMainApplicationFolder" /> 
</Feature> 
</Include> 

:私はMSIパッケージの光にWXSをコンパイルすると

<?xml version="1.0" encoding="utf-8"?> 
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" 
    xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> 
    <Product ...> 
     <!-- components --> 
     <?include bundle.wxi ?> 
     <UI/> 
     <FeatureRef Id="DefaultFeature"> 
      <ComponentRef Id="comp999" /> 
     </FeatureRef> 
    </Product> 
</Wix> 

は、このエラーを述べている:

error LGHT0095 : Multiple primary references were found for Feature 'DefaultFeature' in Product '{...}' and Product '{...}'.

wxsファイルで定義されている機能にコンポーネントを追加するにはどうすればよいですか?

ありがとうございます。

答えて

0

<Feature>の代わりに、インクルードファイルに<ComponentGroup>を使用してください。次に、フィーチャーを1つの場所に定義します。.wxsメインファイルは<Product>要素です。

<Fragment> 
<Component Id="Comp1" Guid="{GUID-GOES-HERE}"> 
    ... 
</Component> 
<Component Id="Comp2" Guid="{GUID-GOES-HERE}"> 
    ... 
</Component> 
<Component Id="Comp3" Guid="{GUID-GOES-HERE}"> 
    ... 
</Component> 

<ComponentGroup Id="CG1"> 
    <ComponentRef Id="Comp1"/> 
    <ComponentRef Id="Comp2"/> 
    <ComponentRef Id="Comp3"/> 
</ComponentGroup> 
</Fragment> 

そしてメインproduct.wxsは、機能を定義して、そこに部品群を備えており、より多くの成分を含むことができます::

例えば、これは、ファイルが見えるかもしれません含める方法です

<Feature Id="MainFeature" Title="..." Level="100"> 
    <ComponentGroupRef Id="CG1"/> 

    <!-- More components can go here --> 
    <Component Id=".."> 
    </Component> 
</Feature> 

さらに、includeの代わりにwxsファイルを含めることもできます。メインwxsが別のwxsから少なくとも1つの要素を参照する限り、内容全体が含まれます。

+0

wxiインクルードファイルを変更できません。このインクルードファイルは自動的に生成されます。 –

+0

ええと、この場合、同じIDを持つFeatureRefを追加する代わりに、それらの追加コンポーネントの属性として 'Feature =" DefaultFeature "を指定することができます... –