Consider: Error on duplicate entries in ResolveFilesToPublish
See original GitHub issueIf 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:
- Created 4 years ago
- Reactions:2
- Comments:5 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We’re working on a PR here: https://github.com/dotnet/sdk/pull/14020
Fixed by #14020