Created
June 27, 2018 07:33
-
-
Save polarstars/a352f648f7e0b9a077dc402f53b5da4f to your computer and use it in GitHub Desktop.
判断系统是否安装了net3.5或4.0框架 #C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static bool IsDotNet35Installed() | |
{ | |
bool ret = false; | |
RegistryKey rk = OpenSoftwareKey(@"\Microsoft\NET Framework Setup\NDP\v3.5"); | |
if (rk != null) | |
{ | |
ret = true; | |
rk.Close(); | |
} | |
else | |
ret = false; | |
return ret; | |
} | |
public static bool IsDotNet4Installed() | |
{ | |
bool ret = false; | |
RegistryKey rk = OpenSoftwareKey(@"\Microsoft\NET Framework Setup\NDP\v4"); | |
if (rk != null) | |
{ | |
ret = true; | |
rk.Close(); | |
} | |
else | |
ret = false; | |
return ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment