Skip to content

Duplicate entries in ResolvedFileToPublish from ReferenceAssemblies and Content #11959

@jkotas

Description

@jkotas

Description

  1. Unzip repro.zip
  2. Run dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true

Result

C:\Program Files\dotnet\sdk\5.0.100-preview.5.20258.6\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(962,5): error MSB4018: The "GenerateBundle" task failed unexpectedly. [C:\repro\repro.csproj]
C:\Program Files\dotnet\sdk\5.0.100-preview.5.20258.6\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(962,5): error MSB4018: System.ArgumentException: Invalid input specification: Found multiple entries with the same BundleRelativePath [C:\repro\repro.csproj]
C:\Program Files\dotnet\sdk\5.0.100-preview.5.20258.6\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(962,5): error MSB4018:    at Microsoft.NET.HostModel.Bundle.Bundler.GenerateBundle(IReadOnlyList`1 fileSpecs) [C:\repro\repro.csproj]

.csproj file for reference:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <RootNamespace>log_import</RootNamespace>
  </PropertyGroup>

  <ItemGroup>
    <Reference Include="Kaitai.Struct.Runtime">
      <HintPath>Kaitai.Struct.Runtime.dll</HintPath>
    </Reference>
  </ItemGroup>

  <ItemGroup>
    <None Update="Kaitai.Struct.Runtime.dll">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  </ItemGroup>

</Project>

The error is due to the last item group. The last item group should just be ignored. The point is that the entry is relevant when developing the project, up until you decide to publish it.

Metadata

Metadata

Assignees

Labels

untriagedRequest triage from a team member

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions