Skip to content

[.NET 9] RuntimeInformation.RuntimeIdentifier includes unexpected OS details on Linux repo installs #114156

@ptr727

Description

@ptr727

Description

Per docs it is expected that RuntimeInformation.RuntimeIdentifier returns OS agnostic RID's.

In my testing the RID's returned on some Linux installs includes the OS name, this is not expected, and breaks usage of the reported RID. (I use the RID to download single file dotnet tools)

Note that the issue may be related to how the SDK/runtime was built and installed, as the behavior on Windows (.NET sourced rom Msft, and Debian (.NET sourced from install script) appear to work, while the SDK/runtime installed using the OS native repository does not produce the correct results.

Summary:
Win11 Msft download : Ok
Debian https://dot.net/v1/dotnet-install.sh : Ok
Ubuntu dotnet-runtime-9.0 : Fail
Alpine dotnet9-runtime : Fail

Reproduction Steps

Windows 11 x64, .NET 9 SDK installed: (Ok)
dotnet --info -> RID: win-x64
Console.WriteLine(RuntimeInformation.RuntimeIdentifier); -> win-x64

Alpine, docker alpine:latest, apk add dotnet9-runtime (Fail)
dotnet --info -> RID: alpine.3.21-x64 (expected linux-musl-x64)
Console.WriteLine(RuntimeInformation.RuntimeIdentifier); -> alpine.3.21-x64 (expected linux-musl-x64)

Debian, docker debian:stable-slim, https://dot.net/v1/dotnet-install.sh (Ok)
dotnet --info -> RID: linux-x64
Console.WriteLine(RuntimeInformation.RuntimeIdentifier); -> linux-x64

Ubuntu, docker ubuntu:rolling, dotnet-runtime-9.0 (Fail)
dotnet --info -> RID: ubuntu.24.10-x64 (expected linux-x64)
Console.WriteLine(RuntimeInformation.RuntimeIdentifier); -> ubuntu.24.10-x64 (expected linux-x64)

Expected behavior

RID returned in dotnet --info and RuntimeInformation.RuntimeIdentifier is consistent with documentation.

Actual behavior

See reproduction steps, it appears that .NET installed via Linux native repos do not return the correct RID.

Regression?

I last tested this behavior in .NET v7 and it worked then, but that was a long time ago.

Known Workarounds

Always install using Msft helper script, but that is not recommended for production use.

Configuration

.NET 9.0.3

See description for install steps on Docker.

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions