我正在尝试询问用于编译我的网络应用程序的 .NET Core 版本。该应用程序部署在带有 Linux 4.9.28-v7+ armv7l 的 Raspberry Pi 2 上。没有看到明显的方法。
这可能吗?
最佳答案
您可以使用以下代码段:
var framework = Assembly
.GetEntryAssembly()?
.GetCustomAttribute<TargetFrameworkAttribute>()?
.FrameworkName;
var stats = new
{
OsPlatform = System.Runtime.InteropServices.RuntimeInformation.OSDescription,
AspDotnetVersion = framework
};
代码位于:weblog.west-wind.com
在我的电脑上运行时返回:
Microsoft Windows 10.0.17134
.NETCoreApp,Version=v2.1
关于linux - 如何在已部署的应用程序中检查 .NET Core 的版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53273998/