System.Environment in .NET Core 1.0

2019-01-27 16:13发布

问题:

Does anybody knows how to get information about current environment and platform in .NET Core? Currently there are no Environment class in Core library.

回答1:

System.Environment is available in the System.Runtime.Extensions package. Ensure you've referenced that package in your project.json.

{
  "frameworks": {
    "dnxcore50": {
      "dependencies": {
        "System.Runtime.Extensions": "4.0.10-*"
      }
    }
  }
}