0
votes

I have two products Product1 & Product2. Product1 uses p1.dll & Product2 uses p2.dll.
I have defined separate ComponentGroups for them but in same wxs file (Groups.wxs).
I have included these ComponentGroups in separate Features F1 & F2 (Feature.wxs).
Then provided FeatureRef for F1 in Product1.wxs and F2 in Product2.wxs as shown below.
In my build system, I have either p1.dll or p2.dll in bin folder.
I have only p1.dll in bin folder when I build the installer for Product1.
However, when I build the installer for Product1, it throws - error LGHT0103: The system cannot find the file '..\bin\p2.dll'

Why should the wix linker look for p2.dll when I have not provided FeatureRef for F2 in Product1?
How can I resolve this?

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

1 Answers

0
votes

Finally I could find the solution. I had included both the ComponentGroups G1 and G2 in the same fragment. So, even if I included only G1 in a product, G2 was also getting included. After adding them in separate fragments, the issue got resolved.

Here is the sample code.

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

Then, I had to create separate files for features F1 and F2.
Probably creating separate fragment for them should also work, though I have not tried it.
Rest of the code is same.