Search code examples
c#coreclrdnx50

Environment.Version equivalent in core clr


The following code is valid for the dnx451 framework but not the dnxcore50

string ver = Environment.Version

This method does not exist:

enter image description here

Is there an equivalent property in the dnxcore50 framework?

Update

as per Victors answer you can use PlatformServices.Default.Runtime eg:

Console.WriteLine("env: {0} {1}", PlatformServices.Default.Runtime.RuntimeType, PlatformServices.Default.Runtime.RuntimeVersion);

output: (on dnx451)

env: Clr 1.0.0-rc1-16231

output: (on dnxcore50)

env: CoreClr 1.0.0-rc1-16231


Solution

  • You can use the properties in IRuntimeEnvironment to get information about the runtime. The following properties are available:

    • RuntimeType
    • RuntimeArchitecture
    • RuntimeVersion
    • RuntimePath