dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.7k stars 1.06k forks source link

dotnet pack --no-build does not respect --runtime option #13983

Open ghost opened 4 years ago

ghost commented 4 years ago

Steps to reproduce

dotnet new console
dotnet build --runtime alpine.3.12-x64
dotnet pack --no-build --runtime alpine.3.12-x64

Expected Result

Microsoft (R) Build Engine version 16.7.0+7fb82e5b2 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Successfully created package 'C:\src\m\experiments\dotnet-pack-bug-demo\bin\Debug\dotnet-pack-bug-demo.1.0.0.nupkg'.

Actual Result

Microsoft (R) Build Engine version 16.7.0+7fb82e5b2 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Program Files\dotnet\sdk\3.1.402\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5026: The file 'C:\src\m\experiments\dotnet-pack-bug-demo\bin\Debug\netcoreapp3.1\dotnet-pack-bug-demo.runtimeconfig.json' to be packed was not found on disk. [C:\src\m\experiments\dotnet-pack-bug-demo\dotnet-pack-bug-demo.csproj]

Workaround

dotnet pack --no-build -property:RuntimeIdentifier=alpine.3.12-x64

... because dotnet pack probably doesn't look in the correct folder for (previous) build output. If RuntimeIdentifier is specified, though, it does. I assume that the --runtime is not propagated correctly (at all?) when --no-build is set.

Environment

dotnet --version
3.1.402

dotnet msbuild /version
Microsoft (R) Build Engine version 16.7.0+7fb82e5b2 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

16.7.0.41201
sfoslund commented 4 years ago

I'm able to repro this locally, thanks for filing this issue!

andrejleal commented 2 years ago

I'm able to repro this locally, thanks for filing this issue! Any ETA assigned?

haondt commented 1 month ago

also asking if there is any eta? Still seems to be a bug 4 years later