question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider: Error on duplicate entries in ResolveFilesToPublish

See original GitHub issue

If multiple entries in ResolveFilesToPublish want to be copied as the same target file,

  • A normal publish succeeds, causing one of the files to be in the publish directory
  • PublishSingleFile fails, since the bundler checks for duplicates.

We should reconcile this behavior. Ideally we should pick the later, since it throws an error rather than silent unpredictable behavior. However, this can cause several customer builds to fail, because of conflicts in nuget packages (which were hitherto undetected).

Sample repro:

For example, considering the template console app with:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
   <RuntimeIdentifier>win-x64</RuntimeIdentifier>
  </PropertyGroup>

  <ItemGroup>
      <PackageReference Include="Microsoft.TestPlatform.CLI" Version="16.5.0"/>
  </ItemGroup>
</Project>

dotnet publish succeeds. dotnet publish /p:PublishSingleFile=true fails.

If we look at the msbuild logs, we see that there are several duplicate entries trying to be bundled into app. For example, the following two DLLs want to be published as Microsoft.TestPlatform.CommunicationUtilities.dll.

.nuget\packages\microsoft.testplatform.cli\16.5.0\contentFiles\any\netcoreapp2.1\Microsoft.TestPlatform.CommunicationUtilities.dll
  CopyToPublishDirectory=PreserveNewest
  RelativePath=Microsoft.TestPlatform.CommunicationUtilities.dll
  TargetPath=Microsoft.TestPlatform.CommunicationUtilities.dll

.nuget\packages\microsoft.testplatform.testhost\16.5.0\lib\netcoreapp2.1\Microsoft.TestPlatform.CommunicationUtilities.dll
  AssetType=runtime
  CopyLocal=true
  CopyToPublishDirectory=PreserveNewest
  DestinationSubPath=Microsoft.TestPlatform.CommunicationUtilities.dll
  NuGetPackageId=Microsoft.TestPlatform.TestHost
  NuGetPackageVersion=16.5.0
  PackageName=Microsoft.TestPlatform.TestHost
  PackageVersion=16.5.0
  PathInPackage=lib/netcoreapp2.1/Microsoft.TestPlatform.CommunicationUtilities.dll
  RelativePath=Microsoft.TestPlatform.CommunicationUtilities.dll

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sfoslundcommented, Oct 20, 2020

Any update on this?

We’re working on a PR here: https://github.com/dotnet/sdk/pull/14020

0reactions
sfoslundcommented, Nov 4, 2020

Fixed by #14020

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting an error about duplicate values in my Web.config ...
I had created a backup of a Web.config file for a different solution and moved it up to the root wwwroot folder.
Read more >
1062 Duplicate entry but there are no duplicates?
It isn't saying that there is a duplicate entry in the table already, it is saying that there is already one entry in...
Read more >
How to Solve Duplicate Entries Error in MySQLdb with ...
The first step in solving the duplicate entries error is to identify the primary key or unique index of the table. This can...
Read more >
Error 'Duplicate Id Specified' or CSV with duplicate records ...
If multiple rows in the CSV file contain the same record ID in the ID column, those rows are considered to be duplicates....
Read more >
Solved: Duplicate Value - Microsoft Power BI Community
I checked the table and there is no duplicated. Anyway I went to the Power Query and deleted duplicated values, but I still...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found