c# - 核心 clr 中的 Environment.Version 等价物

标签 c# coreclr dnx50

以下代码适用于dnx451 框架,但不适用于dnxcore50

string ver = Environment.Version

此方法不存在:

enter image description here

dnxcore50 框架中是否有等效的属性?

更新

根据 Victors 的回答,您可以使用 PlatformServices.Default.Runtime 例如:

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

输出:(在 dnx451 上)

env: Clr 1.0.0-rc1-16231

输出:(在 dnxcore50 上)

env: CoreClr 1.0.0-rc1-16231

最佳答案

您可以使用 IRuntimeEnvironment 中的属性获取有关运行时的信息。以下属性可用:

  • 运行时类型
  • 运行时架构
  • 运行时版本
  • 运行时路径

关于c# - 核心 clr 中的 Environment.Version 等价物,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35145661/

相关文章:

c# - 如何即时创建一个包含所有表的新 SQLite 数据库?

c# - Windows 10 iot (Raspberry PI3 - ARM) 上的 .net 核心安装

.net - 是否可以更改 dnx/dotnetcore 包缓存位置

asp.net-core - 在功能、性能等方面为 Azure Web App 选择 dnx451 和 dnxcore 50

jquery - 在asp.net core中ajax发布后Html不刷新

msbuild - DNP 项目的 Sonarqube 分析

c# - 如何检查二维数组是否仅在 for 循环中是唯一的

c# - 目录不存在。参数名称 : directoryVirtualPath

c# - 如何从XNode读取数据

c# - 如何在 Azure Web App 中使用 CoreCLR 运行 ASP.NET 5 网站?