dotnet pack fails using UseArtifactsOutput=true with multi-targeting and global usings
See original GitHub issueDescribe the bug
I’m testing out an internal library with .NET 8 preview 4 and UseArtifactsOutput=true
and dotnet pack
fails with the following error (as we have treat warnings as errors turned on):
[/runner/_work/LambdaWorker/LambdaWorker/src/LambdaWorker/JustEat.LambdaWorker.csproj::TargetFramework=net7.0]
JustEat.LambdaWorker -> /runner/_work/LambdaWorker/LambdaWorker/artifacts/bin/JustEat.LambdaWorker/release_net6.0/JustEat.LambdaWorker.dll
JustEat.LambdaWorker -> /runner/_work/LambdaWorker/LambdaWorker/artifacts/bin/JustEat.LambdaWorker/release_net7.0/JustEat.LambdaWorker.dll
JustEat.LambdaWorker -> /runner/_work/LambdaWorker/LambdaWorker/artifacts/bin/JustEat.LambdaWorker/release_net8.0/JustEat.LambdaWorker.dll
Successfully created package '/runner/_work/LambdaWorker/LambdaWorker/artifacts/package/release/JustEat.LambdaWorker.8.0.304-preview.293.nupkg'.
Error: /home/runner/.dotnet/sdk/8.0.100-preview.4.23260.5/Sdks/NuGet.Build.Tasks.Pack/buildCrossTargeting/NuGet.Build.Tasks.Pack.targets(221,5): error NU5118: Warning As Error: File '/runner/_work/LambdaWorker/LambdaWorker/artifacts/obj/JustEat.LambdaWorker/release_net7.0/JustEat.LambdaWorker.GlobalUsings.g.cs' is not added because the package already contains file 'src/LambdaWorker/JustEat.LambdaWorker.GlobalUsings.g.cs' [/runner/_work/LambdaWorker/LambdaWorker/src/LambdaWorker/JustEat.LambdaWorker.csproj]
Error: /home/runner/.dotnet/sdk/8.0.100-preview.4.23260.5/Sdks/NuGet.Build.Tasks.Pack/buildCrossTargeting/NuGet.Build.Tasks.Pack.targets(221,5): error NU5118: Warning As Error: File '/runner/_work/LambdaWorker/LambdaWorker/artifacts/obj/JustEat.LambdaWorker/release_net8.0/JustEat.LambdaWorker.GlobalUsings.g.cs' is not added because the package already contains file 'src/LambdaWorker/JustEat.LambdaWorker.GlobalUsings.g.cs' [/runner/_work/LambdaWorker/LambdaWorker/src/LambdaWorker/JustEat.LambdaWorker.csproj]
Successfully created package '/runner/_work/LambdaWorker/LambdaWorker/artifacts/package/release/JustEat.LambdaWorker.8.0.304-preview.293.symbols.nupkg'.
dotnet pack seems to be trying to add the same compiler-generating global using files for each TFM to the symbols package and emitting a warning.
To Reproduce
Pending: I haven’t yet worked out what the “magic combination” of factors is that causes this problem to make a simple repro. The repository I’m hitting this with is private so I can’t share as-is.
Exceptions (if any)
None.
Further technical details
.NET SDK 8.0.100-preview.4.23260.5
Issue Analytics
- State:
- Created 4 months ago
- Comments:21 (21 by maintainers)
Top Results From Across the Web
dotnet pack fails using UseArtifactsOutput=true with multi- ...
dotnet pack seems to be trying to add the same compiler-generating global using files for each TFM to the symbols package and emitting...
Read more >c# - dotnet pack seems to use outdated sourcecode, even ...
The real problem seems to have been that dotnet used an outdated build in the Release folder to generate the .nupkg.
Read more >'dotnet pack' uses Release configuration - .NET
Learn about a breaking change in the .NET 8 SDK where 'dotnet pack' uses the 'Release' configuration by default.
Read more >dotnet pack command - .NET CLI
The dotnet pack command creates NuGet packages for your .NET project.
Read more >Support multiple .NET Framework versions in your project file
Description of the various methods to target multiple .NET Framework versions from within a single NuGet package in your project file.
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
Done: https://github.com/NuGet/Home/issues/12615
Sorry, nuget/nuget.client is where the code lives and nuget/home is where issues are filed: https://github.com/NuGet/Home/