Skip to content

Dotnet publish is ignoring --runtime parameter #46053

@iridin

Description

@iridin

Describe the bug

Since the SDK 9.0.102 version, publishing a containerized application that is intended for multiple platforms, no longer works.
When specifying --runtime linux-x64 parameter, I can see that the dll is compiled both for linux-x64 and win-x64 platforms, subsequently causing the following error:

C:\Program Files\dotnet\sdk\9.0.102\Containers\build\Microsoft.NET.Build.Containers.targets(251,5): error :
BaseImageNotFoundException: The RuntimeIdentifier 'win-x64' is not supported by dotnet/runtime-deps:8.0. The supported RuntimeIdentifiers are linux-x64,linux-arm,linux-arm64

With .NET Core SDK '9.0.101' version and all previous (8.0.x) versions, this worked correctly, compiling only for the specified runtime.

To Reproduce

Call this command to publish the solution (while having Docker switched to Linux containers):

dotnet publish XYZ.sln --configuration Release --runtime linux-x64 /t:PublishContainer /nodeReuse:False /p:Configuration=Release /p:GeneratePackageOnBuild=True /p:ContainerRuntimeIdentifier=linux-x64

Get this output (trimmed for brevity):

XYZCommon succeeded (5,2s) → src\XYZCommon\bin\Release\net8.0\linux-x64\XYZCommon.dll
XYZCommon succeeded (0,1s) → src\XYZCommon\bin\Release\net8.0\linux-x64\XYZCommon.dll
XYZCommon succeeded (0,4s) → src\XYZCommon\bin\Release\net8.0\linux-x64\XYZCommon.dll
XYZCommon succeeded (0,2s) → src\XYZCommon\bin\Release\net8.0\linux-x64\XYZCommon.dll
XYZCommon succeeded (3,3s) → src\XYZCommon\bin\Release\net8.0\win-x64\XYZCommon.dll
XYZCommon succeeded (1,7s) → src\XYZCommon\bin\Release\net8.0\win-x64\XYZCommon.dll
XYZ failed with 1 error(s) (4,1s) → Release\win-x64\XYZ
C:\Program Files\dotnet\sdk\9.0.102\Containers\build\Microsoft.NET.Build.Containers.targets(251,5): error :
BaseImageNotFoundException: The RuntimeIdentifier 'win-x64' is not supported by dotnet/runtime-deps:8.0. The supported RuntimeIdentifiers are linux-x64,linux-arm,linux-arm64

Exceptions (if any)

Further technical details

  • dotnet --info

.NET SDK:
Version: 9.0.102
Commit: cb83cd4
Workload version: 9.0.100-manifests.4a54b1a6
MSBuild version: 17.12.18+ed8c6aec5

Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.102\

.NET workloads installed:
[ios]
Installation Source: VS 17.12.35707.178
Manifest Version: 18.1.9163/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.ios\18.1.9163\WorkloadManifest.json
Install Type: Msi

[android]
Installation Source: VS 17.12.35707.178
Manifest Version: 35.0.7/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.android\35.0.7\WorkloadManifest.json
Install Type: Msi

[maccatalyst]
Installation Source: VS 17.12.35707.178
Manifest Version: 18.1.9163/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maccatalyst\18.1.9163\WorkloadManifest.json
Install Type: Msi

[aspire]
Installation Source: VS 17.12.35707.178
Manifest Version: 8.2.2/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.2\WorkloadManifest.json
Install Type: Msi

[maui-windows]
Installation Source: VS 17.12.35707.178
Manifest Version: 9.0.14/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maui\9.0.14\WorkloadManifest.json
Install Type: Msi

Configured to use loose manifests when installing new manifests.

Host:
Version: 9.0.1
Architecture: x64
Commit: c8acea2262

.NET SDKs installed:
6.0.428 [C:\Program Files\dotnet\sdk]
8.0.404 [C:\Program Files\dotnet\sdk]
9.0.102 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.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

Microsoft Visual Studio Enterprise 2022 (64-bit) - Current
Version 17.12.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-ContainersRelated to dotnet SDK containers functionalityuntriagedRequest triage from a team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions