OutputPath contains double path separator leading to NU5019 in nuget pack
See original GitHub issueDescribe the bug
.NET 8 Preview 4 SDK Requires: A .NET SDK project with multi-targeting (TargetFrameworks plural) and a custom .nuspec The OutputPath property ends up with a double slash (path separator) because PlatformName is undefined. Nuget pack doesn’t like the double-slash, leading to a NU5019 (file not found) error.
To Reproduce
Here’s a gist: https://gist.github.com/pharring/aef107238843a1c6c7ea9f0be87795d6
Copy the three files to a local directory and build it with dotnet build
Output:
Build FAILED.
C:\Program Files\dotnet\sdk\8.0.100-preview.4.23260.5\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(221,5): error NU5019: File not found: 'b
in\\Debug\foo.txt'. [C:\throwaway\foo2\foo.csproj]
Exceptions (if any)
Note that this repros only with multitargeting. If you change TargetFrameworks
to TargetFramework
(singular), then it works.
The problem seems to be that PlatformName
is not set in the multitargeting case (it should default to AnyCpu
) so OutputPath
gets initialized with a double path separator.
Further technical details
- Output of
dotnet --info
:
.NET SDK:
Version: 8.0.100-preview.4.23260.5
Commit: 2268e7b15c
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22621
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.100-preview.4.23260.5\
.NET workloads installed:
There are no installed workloads to display.
Host:
Version: 8.0.0-preview.4.23259.5
Architecture: x64
Commit: 84a3d0e37e
.NET SDKs installed:
7.0.400-preview.23274.1 [C:\Program Files\dotnet\sdk]
8.0.100-preview.4.23260.5 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0-preview.4.23260.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0-preview.4.23259.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.0-preview.4.23260.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
- The IDE (VS / VS Code/ VS4Mac) you’re running on, and its version: VS 2022 17.7 Preview 2
Issue Analytics
- State:
- Created 4 months ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Thanks folks for the report, this was an SDK regression. I’ve sent #33003 to fix it.
@dsplaisted NuGet thinks this is related to the output path changes, can you check?