-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Milestone
Description
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
AdamCavinessImperatorn
Metadata
Metadata
Assignees
Labels
No labels