环境。版本相当于核心clr
以下代码对dnx451
框架有效,但对dnxcore50
string ver = Environment.Version
此方法不存在:
dnxcore50框架中是否有等价的属性?
更新
根据Victors的回答,你可以使用PlatformServices.Default.Runtime
例如:
Console.WriteLine("env: {0} {1}", PlatformServices.Default.Runtime.RuntimeType, PlatformServices.Default.Runtime.RuntimeVersion);
输出:(在dnx451上)
环境:Clr 1.0.0-rc1-16231
输出:(在dnxcore50上)
环境:CoreClr 1.0.0-rc1-16231
您可以使用IRuntimeEnvironment中的属性来获取有关运行时的信息。 可以使用以下属性:
- RuntimeType
- RuntimeArchitecture
- RuntimeVersion
- RuntimePath