问题
The following code is valid for the dnx451
framework but not the dnxcore50
string ver = Environment.Version
This method does not exist:
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
回答1:
You can use the properties in IRuntimeEnvironment to get information about the runtime. The following properties are available:
- RuntimeType
- RuntimeArchitecture
- RuntimeVersion
- RuntimePath
来源:https://stackoverflow.com/questions/35145661/environment-version-equivalent-in-core-clr