C# winform 檢測當前電腦安裝的.net framework版本

private static bool GetDotNetRelease(int release)string

{
const string subkey = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\";
using (RegistryKey ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey))
{
if (ndpKey != null && ndpKey.GetValue("Release") != null)
{
return (int)ndpKey.GetValue("Release") >= release ? true : false;
}
return false;
}
}
 
//release是你須要檢測的版本號,好比.NET4.0,輸入4
相關文章
相關標籤/搜索