使用 C#,询问 .NET Runtime 正在运行的版本的最佳方法是什么?答案:使用 Environment.Version 属性。
使用Environment.Version
。这个属性返回当前运行代码的 CLR 版本号,且支持所有版本的 CLR。
文档
You can write a simple method for this purpose:
public static void GetVersion() {
Environment.Version.ToString() }
You can also find the installed versions in the following location:
C:\WINDOWS\Microsoft.NET\Framework
If you are using Visual Studio, run
Visual Studio commander from the
start menu, and enter clrver
, and it gives you the
running version.
And for sure, you can always check your registry for that:
HKEY_LOCAL_MACHINE \ software \ Microsoft \ Net Framework \