4using System.Reflection;
21 var monoRuntimeType = Type.GetType(
"Mono.Runtime");
22 if (monoRuntimeType !=
null) {
23 string displayName = (string)monoRuntimeType.GetMethod(
"GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static).Invoke(
null,
null);
25 Version =
new Version(displayName.Substring(0, displayName.IndexOf(
' ')));
29 if (!Platform.IsWindows)
34 const string subkey =
@"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\";
35 using (RegistryKey ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey))
36 if (ndpKey !=
null && ndpKey.GetValue(
"Release") is
int releaseKey)
45 if (releaseKey >= 528040)
47 if (releaseKey >= 461808)
49 if (releaseKey >= 461308)
51 if (releaseKey >= 460798)
53 if (releaseKey >= 394802)
55 if (releaseKey >= 394254)
57 if (releaseKey >= 393295)
59 if (releaseKey >= 379893)
61 if (releaseKey >= 378675)
63 if (releaseKey >= 378389)
66 throw new Exception(
"No 4.5 or later version detected");
static Version CheckFor45PlusVersion(int releaseKey)
static FrameworkVersion()
static readonly Version Version
static readonly Framework Framework