Open JanKrivanek opened 1 year ago
Discussed offline with @zivkan:
CopyToOutputDirectory
mode that would compare timestamps/size/content@JanKrivanek Could you able to give me name of nuget package can used to repro this problem? It looks it could be any package with content files. But if you know one what would be great.
@Nico-1987 (the original issue creator) - is there any publicly available nuget that can be used to quickly repro the issue?
We use contentFiles with copyToOutput a lot in our internal NuGet packages, so i had to search for a public package that does the same. I actually found a nice example. The ContentFilesExample package.
Steps to reproduce:
<PackageReference Include="ContentFilesExample" Version="1.0.2" />
<PackageReference Include="ContentFilesExample" Version="1.0.1" />
Hope this helps. Thanks for picking this up!
I can repro this and there's workaround is available.
Team Triage: Ideally NuGet would keep track of all of the content files and which package they came from. From build to build, it would detect if the same package was in use and if not, delete the content files that were copied in a previous build. That way if a new package was referenced, the existing files would be deleted and the same MSBuild logic would run to copy the files to the output directory. If the package version did not change, MSBuild's Copy task would only copy the files if they were newer.
NuGet Product Used
dotnet.exe, MSBuild.exe
Product Version
This can be reproduced in Visual Studio 2022 version 17.2, using NuGet 6.2
Worked before?
No response
Impact
None
Repro Steps & Context
Copying from the issue in MSBuild repo (https://github.com/dotnet/msbuild/issues/8276):
Verbose Logs
No response