wixtoolset / issues

WiX Toolset Issues Tracker
http://wixtoolset.org/
130 stars 24 forks source link

error WIX0095: Multiple primary references were found for Feature 'TestUpdate' in Feature 'TestApp' and Feature 'TestApp' #8539

Closed Prakash08061993 closed 3 months ago

Prakash08061993 commented 5 months ago

WiX Version

5.0.0

.NET or MSBuild or Visual Studio Version

MsBuild Version 17.8.3

HeatWave Version

1.0.2.1

Windows Version

Win 11

Repro Repo

No response

Repro Steps

I have 2 projects in one solution. 'Common' project and 'Setup' project. In 'Common' project, I have 'Library.wxs' under which I have

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
  <Fragment>
    <!-- Magic property that links this file to the main setup -->
    <Property Id="SetupCommon" Value="SetupCommon"/>

    <!-- Property used to check for .NET 4.0 -->
    <PropertyRef Id="NETFRAMEWORK40FULL" />

    <!-- Sets the current SDK version-->
    <WixVariable Id="SdkVersion" Value="38.10" />

    <Binary Id="AddDataToGAC" SourceFile="..\..\AddToGAC.CustomAction\Release\AddToGAC.CA.dll" />

    <CustomAction Id="CopyDataToTemp" Return="check" Execute="immediate" DllEntry="CopyDataToTemp" BinaryRef="AddDataToGAC" />

    <!-- Conditions -->
    <Launch Condition="Installed OR NETFRAMEWORK40FULL" Message="This application requires .NET Framework 4.0. Please install .NET Framework and run this setup again." />

    <WixVariable Id="WixUIBannerBmp" Value="..\Common\Images\top_banner.bmp" />
    <WixVariable Id="WixUIDialogBmp" Value="..\Common\Images\left_banner.bmp" />

    <!-- Customization of the dialog set -->
    <UI Id="WixUI_FeatureTree">
      //code related to this
    </UI>

    <UIRef Id="WixUI_Common" />

    <!-- Add/Remove Program Icon -->
    <Icon Id="TestIcon" SourceFile="..\Common\Images\Icon.ico" />
    <Property Id="ARPPRODUCTICON" Value="TestIcon" />

      <!-- Feature Tree -->
      <Feature Id="TestApp" Title="TestApp" Description="Contains the common components of TestApp." Display="expand" ConfigurableDirectory="INSTALLDIR" Level="1">

          <Feature Id="TestUpdate" Title="TestUpdate" Level="1" Description="Support automatic upgrades of TestUpdate client.">
              <MergeRef Id="UpdateUtil.Installer" />
              <Level Value="0" Condition="DISABLE_AUTOUPDATE" />
          </Feature>
          <Feature Id="TestBas" Title="Test Information" Level="1">
              <MergeRef Id="TestBas.User" />
          </Feature>

      <InstallUISequence>
      <Custom Action="check" Before="AppSearch" Condition="NOT Installed" />
    </InstallUISequence>

    <!-- Required Actions by Merge Modules -->
    <InstallExecuteSequence>
      <ResolveSource After="CostInitialize" Condition="NOT Installed" />
      <Custom Action="check" After="ResolveSource" Condition="NOT Installed" />
      <AppSearch After="check" />
      <LaunchConditions After="CostFinalize" />
      <RemoveShortcuts Sequence="3200" />
      <CreateShortcuts Sequence="4466" />
    </InstallExecuteSequence>
  </Fragment>
</Wix>
  1. Then in 'Setup' project I have Product.wxs

    
    <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
    
    <Package Name="TestPackage" Language="1033" Version="!(wix.WixVersion)" Manufacturer="Test Package" UpgradeCode="GUID" InstallerVersion="301"><SummaryInformation Description="TestPackage Setup" Manufacturer="TestPackage " />
    
    <!-- Upgrades 'this' product -->
    <MajorUpgrade IgnoreRemoveFailure="yes" MigrateFeatures="yes" Schedule="afterInstallFinalize" DowngradeErrorMessage="A later version of this product is already installed." />
    
    <!-- Required to have the Common Library merged -->
    <PropertyRef Id="SetupCommon" />
    
      <Directory Id="$(var.PlatformProgramFilesFolder)">
        <Directory Id="TestApp" Name="TestApp">
          <Directory Id="INSTALLDIR" Name="Test">
          </Directory>
        </Directory>
      </Directory>
    </Package>


**Getting below error:
 error WIX0095: Multiple primary references were found for Feature 'TestUpdate' in Feature 'TestApp' and Feature 'TestApp'.
 error WIX0095: Multiple primary references were found for Feature 'TestBas' in Feature 'TestApp' and Feature 'TestApp'.** 

### Actual Result

**Getting below error:
 error WIX0095: Multiple primary references were found for Feature 'TestUpdate' in Feature 'TestApp' and Feature 'TestApp'.
 error WIX0095: Multiple primary references were found for Feature 'TestBas' in Feature 'TestApp' and Feature 'TestApp'.** 

### Expected Result

It should build properly.

### Acknowledgements

- [X] I acknowledge that this is a fully completed bug report. It is not a question or attempt to get help debugging my issue (because those should be sent to Discussions).
bevanweiss commented 5 months ago

Do you have your 'Common' project configured as a WiX Library? Or do you have two MSI Package projects that you're trying to link together in some weird way?

It sounds like you should have your 'Common' as a WiX Library, and then have a reference from your 'Setup' MSI Package project back to your library project. If this is how you have it, you weren't very clear.

You've got a very confusing arrangement. Why does your library define what Icon is used for the MSI Package? More common would be that the library contains just references to perhaps a Feature 'sub-tree', with components etc under it. Then from the main MSI Package project you'd reference in that Feature sub-tree with a FeatureRef link. Or it might just get linked in through a ComponentGroupRef (if the MSI Package isn't really using Features).

barnson commented 5 months ago

This screams for a minimal reproducible example as an attachment or GitHub repo. Features in .wixlibs work but there are lots of moving parts in your post that we can't reproduce (e.g., merge modules).

barnson commented 3 months ago

If you can provide additional detail, please attach it here and we'll re-open the issue.