【发布时间】:2018-06-23 20:49:00
【问题描述】:
.NET Standard Library — One library to rule them all.
.NET 标准库功能可能因运行它的 .NET 平台而异:
- .NET 框架
- .NET Core
- Xamarin
如何查看当前运行 .NET Standard 库的 .NET 平台?
例如:
// System.AppContext.TargetFrameworkName
// returns ".NETFramework,Version=v4.6.1" for .NET Framework
// and
// returns null for .NET Core.
if (IsNullOrWhiteSpace(System.AppContext.TargetFrameworkName))
// the platform is .NET Core or at least not .NET Framework
else
// the platform is .NET Framework
这是回答问题的可靠方法吗(至少对于 .NET Framework 和 .NET Core)?
【问题讨论】:
标签: c# .net-core .net-standard .net-standard-2.0