Skip to content

How to detect linux distribution name/version when in WSL? #30213

@tlmii

Description

@tlmii

Over at https://github.com/aspnet/HttpRepl, there's some code that does detection of linux distro in order to decide if some STTY settings need to be changed.

This works fine on normal installs of Ubuntu, but in Ubuntu 18.04 on WSL2, the call to RuntimeInformation.OSDescription returns the following:

"Linux 4.19.43-microsoft-standard dotnet/corefx#1 SMP Mon May 20 19:35:22 UTC 2019"

Is there a way to get the distribution name/version from .NET Core in this scenario? Or should we resort to something like piping the output of lsb_release -a?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions