您的位置:首页 > 其它

如何检测是否安装了.NET 2.0和.NET 3.0

2007-10-07 17:22 337 查看
代码来自Paint.NET的PaintDotNet.SystemLayer.OS类

这段代码是通过检查注册表中的项来确定.NET 2.0/3.0是否安装的。由于Paint.NET是由微软员工参与开发的,可以认为这是比较准确的判断方法。大家借鉴一下检测方法就可以了,不用太在意实现,在C++中这种检测方法同样可以实现。

private static bool IsDotNet2VersionInstalled(int major, int minor, int build)

private static bool IsDotNet3VersionInstalled(int major, int minor, int build)

private static bool CheckForRegValueEquals1(string regKeyName, string regValueName)

{

{

{

value = key.GetValue(regValueName);

}

return (value != null && value is int && (int)value == 1);

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: