Skip to content

Instantly share code, notes, and snippets.

@polarstars
Created June 27, 2018 07:33
Show Gist options
  • Save polarstars/a352f648f7e0b9a077dc402f53b5da4f to your computer and use it in GitHub Desktop.
Save polarstars/a352f648f7e0b9a077dc402f53b5da4f to your computer and use it in GitHub Desktop.
判断系统是否安装了net3.5或4.0框架 #C#
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