如何获取有关运行时.Net Core的信息

Ser*_*hur 5 asp.net-core-mvc .net-core asp.net-core asp.net-core-1.0 .net-core-rc2

我有一个适用于Linux和Windows的应用程序.我需要知道应用程序在哪里使用差异代码.谢谢

Ral*_*ing 5

您可能正在寻找System.Runtime.InteropServices.RuntimeInformation使用该IsOsPlatform功能进行运行时检查的功能。

看一下视频教程https://channel9.msdn.com/Series/aspnetmonsters/ASPNET-Monsters-Episode-46-Finding-Platform-Information of ASP.NET Monsters。