判断 .NET Framework安装版本
How To Determine the .NET Framework Installed Versions
![]() |
This topic is a how to. Please keep it as clear and simple as possible. Avoid speculative discussions as well as a deep dive into underlying mechanisms or related technologies. |
Table of Contents
- Introduction
- The Microsoft.NET\Framework Folder
- Registry Keys
- Determining the .NET Framework Version by Code
- The CLRVER Tool
- Other Languages
Introduction
You can install and run multiple versions of the .NET Framework on a computer and each version can be installed in any order.
Starting from Windows XP, the operating system comes with a .NET Framework version installed and ready for use; the user can install a more recent version to get all the advantages that comes with the newest class libraries and namespaces provided by the most recent versions of the .NET Framework.
The Microsoft.NET\Framework Folder
Each .NET Framework version can be installed side-by-side and each version's files will be installed into a subfolder of the Windows main directory, identified by the environment variable %WINDIR%. To see which versions are installed, look into the %WINDIR% directory for the Microsoft.NET\Framework folder (you should also view the Framework64directory if you're running a 64-bit operating system, which can have 32 or 64-bit versions installed or both): each version of the .NET Framework has a directory and the first two digits of the directory name identify the .NET Framework version; for example: v1.1.4322 for the .NET Framework 1.1, v2.0.50727 for the .NET Framework 2.0, v3.5 for the .NET Framework 3.5 and so on.
Figure 1 depicts the folders containing the files for multiple .NET Framework version installed on a computer running Windows 7 Ultimate x64 Service Pack 1.

Figure 1: .NET Framework version specific subfolders.
Registry Keys
The informations related to the .NET Framework installation (along with the informations regarding the status of the installed Service Packs) are stored in the Windows registry under theHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP key. Figure 2 depicts the registry keys for multiple .NET Framework version installed on a computer running Windows 7 Ultimate x64 Service Pack 1.

Figure 2: .NET Framework version specific registry keys.
Table 1 provides a list of the stored values according to each installed .NET Framework version.
| .NET Framework Version | Service Pack Level | Registry Key Name | Value |
|---|---|---|---|
| 4 - Client | Original Release | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client | Name: Install, Type:REG_DWORD, Data: 1 |
| HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client | Name: Version, Type: REG_SZ, Data: 4.0.30319.0 | ||
| 4 - Full | Original Release | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full | Name: Install, Type:REG_DWORD, Data: 1 |
| HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full | Name: Version, Type: REG_SZ, Data: 4.0.30319.0 | ||
| 3.5 | Original Release | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5 | Name: Install, Type:REG_DWORD, Data: 1 |
| HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5 | Name: SP, Type:REG_DWORD, Data: 0 | ||
| 3.5 | Service Pack 1 | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5 | Name: Install, Type:REG_DWORD, Data: 1 |
| HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5 | Name: SP, Type:REG_DWORD, Data: 1 | ||
| 3.0 | Original Release | Follow the deployment and detection guidance in the document "Microsoft .NET Framework 3.0 Deployment Guide " on the MSDN Library |
|
| HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0 | Name: SP, Type:REG_DWORD, Data: 0 | ||
| 3.0 | Service Pack 1 | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0 | Name: Install, Type:REG_DWORD, Data: 1 |
| HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0 | Name: SP, Type:REG_DWORD, Data: 1 | ||
| 3.0 | Service Pack 2 | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0 | Name: Install, Type:REG_DWORD, Data: 1 |
| HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0 | Name: SP, Type:REG_DWORD, Data: 2 | ||
| 2.0 | Original Release | HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v2.0.50727 | Name: Install, Type:REG_DWORD, Data: 1 |
| HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v2.0.50727 | Name: SP, Type:REG_DWORD, Data: 0 | ||
| 2.0 | Service Pack 1 | HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v2.0.50727 | Name: Install, Type:REG_DWORD, Data: 1 |
| HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v2.0.50727 | Name: SP, Type:REG_DWORD, Data: 1 | ||
| 2.0 | Service Pack 2 | HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v2.0.50727 | Name: Install, Type:REG_DWORD, Data: 1 |
| HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v2.0.50727 | Name: SP, Type:REG_DWORD, Data: 2 | ||
| 1.1 (on 32-bit operating systems) | Original Release | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322 | Name: Install, Type:REG_DWORD, Data: 1 |
| HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322 | Name: SP, Type:REG_DWORD, Data: 0 | ||
| 1.1 (on 32-bit operating systems) | Service Pack 1 | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322 | Name: Install, Type:REG_DWORD, Data: 1 |
| 1.1 (on 64-bit operating systems) | Original Release | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322 | Name: Install, Type:REG_DWORD, Data: 1 |
| HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322 | Name: SP, Type:REG_DWORD, Data: 0 | ||
| 1.1 (on 64-bit operating systems) | Service Pack 1 | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322 | Name: Install, Type:REG_DWORD, Data: 1 |
| HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322 | Name: SP, Type:REG_DWORD, Data: 1 | ||
| 1.0 (on supported platforms except for Windows XP Media Center and Tablet PC) | Original Release | HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components\{78705f0d-e8db-4b2d-8193-982bdda15ecd} | Name: Version, Type: REG_SZ, Data: 1.0.3705.0 |
| 1.0 (on supported platforms except for Windows XP Media Center and Tablet PC) | Service Pack 1 | HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components\{78705f0d-e8db-4b2d-8193-982bdda15ecd} | Name: Version, Type: REG_SZ, Data: 1.0.3705.1 |
| 1.0 (on supported platforms except for Windows XP Media Center and Tablet PC) | Service Pack 2 | HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components\{78705f0d-e8db-4b2d-8193-982bdda15ecd} | Name: Version, Type: REG_SZ, Data: 1.0.3705.2 |
| 1.0 (on supported platforms except for Windows XP Media Center and Tablet PC) | Service Pack 3 | HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components\{78705f0d-e8db-4b2d-8193-982bdda15ecd} | Name: Version, Type: REG_SZ, Data: 1.0.3705.3 |
| 1.0 (shipped with Windows XP Media Center 2002/2004 and Tablet PC 2004) | Service Pack 2 | HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components\{FDC11A6F-17D1-48f9-9EA3-9051954BAA24} | Name: Version, Type: REG_SZ, Data: 1.0.3705.2 |
| 1.0 (shipped with Windows XP Media Center 2005 and Tablet PC 2005) | Service Pack 3 | HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components\{FDC11A6F-17D1-48f9-9EA3-9051954BAA24} | Name: Version, Type: REG_SZ, Data: 1.0.3705.3 |
Table 1: .NET Framework version specific registry keys values.
To detect the existence of a specific .NET Framework version regardless of the Service Pack level, or to detect a service pack level or a later service pack level of the same .NET Framework version, use the registry information that listed Table 2.
| .NET Framework Version | Service Pack Level | Registry Key Name | Value |
|---|---|---|---|
| 4 - Client | Any Version | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client | Install = 1 |
| 4 - Full | Any Version | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full | Install = 1 |
| 3.5 | Any Version | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5 | Install = 1 |
| 3.5 | Service Pack 1 or Greater | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5 | SP >= 1 |
| 3.0 | Any Version | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0 | Install = 1 |
| 3.0 | Service Pack 1 or Greater | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0 | SP >= 1 |
| 3.0 | Service Pack 2 or Greater | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0 | SP >= 2 |
| 2.0 | Any Version | HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v2.0.50727 | Install = 1 |
| 2.0 | Service Pack 1 or Greater | HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v2.0.50727 | SP >= 1 |
| 2.0 | Service Pack 2 or Greater | HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v2.0.50727 | SP >= 2 |
| 1.1 | Any Version | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322 | Install = 1 |
| 1.1 | Service Pack 1 | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322 | SP >= 1 |
| 1.0 | Any Version | HKEY_LOCAL_MACHINE\Software\Microsoft\.NET Framework\Policy\v1.0 | Name: 3705, Type: REG_SZ, exists |
| 1.0 (on supported platforms except for Windows XP Media Center and Tablet PC) | Service Pack 1 or Greater | HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components\{78705f0d-e8db-4b2d-8193-982bdda15ecd} | Version >= 1.0.3705.1 |
| 1.0 (on supported platforms except for Windows XP Media Center and Tablet PC) | Service Pack 2 or Greater | HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components\{78705f0d-e8db-4b2d-8193-982bdda15ecd} | Version >= 1.0.3705.2 |
| 1.0 (on supported platforms except for Windows XP Media Center and Tablet PC) | Service Pack 3 or Greater | HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components\{78705f0d-e8db-4b2d-8193-982bdda15ecd} | Version >= 1.0.3705.3 |
| 1.0 (shipped with Windows XP Media Center 2002/2004 and Tablet PC 2004) | Service Pack 2 or Greater | HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components\{FDC11A6F-17D1-48f9-9EA3-9051954BAA24} | Version >= 1.0.3705.2 |
| 1.0 (shipped with Windows XP Media Center 2005 and Tablet PC 2005) | Service Pack 3 or Greater | HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components\{FDC11A6F-17D1-48f9-9EA3-9051954BAA24} | Version >= 1.0.3705.2 |
Table 2: .NET Framework version specific registry keys values regardless of the Service Pack level.
Determining the .NET Framework Version by Code
The .NET Framework version can be determined by writing code that queries the Common Language Runtime (CLR) version by using the Version property of the System.Environment
class, as in the following C# code snippet
using System; class Sample
{
public static void Main()
{
Console.WriteLine();
Console.WriteLine("Version: {0}", Environment.Version.ToString());
}
}
If you compile this program with the .NET Framework 3.5, this property's value will be "2.0.50727.3603".
The CLRVER Tool
The CLR Version tool (Clrver.exe) reports all the installed versions of the Common Language Runtime (CLR) on the computer. This tool is automatically installed with Visual Studio and with the Windows SDK and it must be executed from the Visual Studio Command Prompt or the Windows SDK Command Prompt.
At the command prompt type the following
clrver [option]
where [option] can be -all to display all the managed processes and the version of the CLR they are using, -? to display command syntax and options for the tool or pid to display the version(s) of the CLR used by the process that has the specified process ID. Running the tool with no options displays all installed CLR versions.
判断 4.5: https://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx
判断 .NET Framework安装版本的更多相关文章
- delphi判断.net FrameWork是否已安装
判断系统中.NET FrameWork已安装版本的方法很多,比如检查C:\Windows\Microsoft.NET\Framework\下的子目录,但是子目录往往是包含版本号,比如v2.0.5072 ...
- .NET/C# 检测电脑上安装的 .NET Framework 的版本
原文:.NET/C# 检测电脑上安装的 .NET Framework 的版本 如果你希望知道某台计算机上安装了哪些版本的 .NET Framework,那么正好本文可以帮助你解决问题. 本文内容 如何 ...
- .NET Framework各版本汇总以及之间的关系
目录(?)[-] 原文链接:http://blog.csdn.net/kingmax54212008/article/details/25886345 NET Framework 版本关系 获取NET ...
- .NET Framework个版本说明
.NET Framework .NET版本 1.0 1.1 2.0 3.0 3.5 4.0 4.5 完整版本 1.0.3705.0 1.1.4322.573 2.0.50727.42 3.0.4506 ...
- ASP.NET在IIS7中如何更改网站的.net framework框架版本
IIS7安装好以后使用了.net 2.0 framework框架,经过折腾发现如下方法可以更改框架版本,从而可以部署使用其他版本框架开发的网站 方法一:建立网站时设置.net框架版本 方法二:对于已经 ...
- 简单概述 .NET Framework 各版本区别
目前已发行的版本有1.0.1.1.2.0.3.0.3.5.4.0.4.5(及4.5.1.4.5.2).4.6(及4.6.1). 1.0版本:最初的.net framework版本,作为一个独立的工具包 ...
- [转]在linux下如何判断是否已经安装某个软件?软件安装在哪个目录
<1>在linux下如何判断是否已经安装某个软件? ++++++++++++++++++++++++++++++++++++++++++ rpm -qa|grep 软件包 ++++++++ ...
- .net Framework各个版本之间的发展
原文:.net Framework各个版本之间的发展 上个星期看到了.NET 4.0框架退休日期逐渐临近文章,发现自己一直在使用NET FrameWork,身为一个NET程序员,里面大概的区别自己还 ...
- .NET Framework 各版本区别
.NET Framework 各版本区别 .NET Framework 1.1 自1.0版本以来的改进:自带了对mobile asp .net控件的支持.这在1.0版本是以附加功能方式实现的,现在已经 ...
随机推荐
- WCF、Web API、WCF REST、Web Service比较
原文地址:http://www.dotnet-tricks.com/Tutorial/webapi/JI2X050413-Difference-between-WCF-and-Web-API-and- ...
- MVC5知识点记录
IIS/ASP.NET管道 原理永远是重中之重,所以在开篇的地方,先了解一下地址栏输入网址回车之后的故事. 不同IIS版本处理请求也不一样 IIS5 IIS 5.x 运行在进程InetInfo.exe ...
- 前端CDN公共库
通过使用公共的CDN脚本和样式库,可以在一定程度上加速访问.节省服务器流量.提升你的网站用户体验.本文将介绍国内比较常用的几种免费的CDN库,包括百度.新浪.360.又拍和七牛等. 百度CDN公共库 ...
- Windows常用快捷方式
总结了其他常用的快捷方式: Ctrl+C 复制 . Ctrl+V粘贴. Ctrl+X剪切. Delete删除. Alt+Tab 应用程序切换 Ctrl+Alt+Delete Ctrl+shift+E ...
- 【整理】Linux下中文检索引擎coreseek4安装,以及PHP使用sphinx的三种方式(sphinxapi,sphinx的php扩展,SphinxSe作为mysql存储引擎)
一,软件准备 coreseek4.1 (包含coreseek测试版和mmseg最新版本,以及测试数据包[内置中文分词与搜索.单字切分.mysql数据源.python数据源.RT实时索引等测 ...
- 基于fastweixin的微信开发环境搭建(一)
由于公司业务需要,开发微信版本,才开始接触微信公众平台.在github折腾了几天,试过好几个微信sdk,最终选择fastweixin.个人觉得这个框架还是值得使用的,使用也简单.那么问题来了,很多人想 ...
- 命令查询网站是否开启CDN加速
1.使用ping命令 不一定准确 运行-CMD 直接输入ping 域名 C:\Users\6503>ping www.netnic.com.cn 正在 Ping u999.v.qingcdn ...
- Linux下安装 MySQL
Ubuntu环境 使用二进制安装包安装,相对简单绿色 1.到官网下载二进制压缩包http://dev.mysql.com/downloads/mysql/ 2.选择需要的版本 目前最新为5.7.之后选 ...
- 学习MySQL之数据类型(四)
一. 整数类型: 整数类型 占用字节 最小值 最大值 TINYINT 1 有符号 -128 无符号0 有符号127 无符号255 SMALLINT 2 有符号-3 2768 无符号0 有符号3 2 ...
- Myeclipse 构建工作空间出错
MyEclipse工作空间报错如下:'Building workspace' has encountered a problem. Errors occurred during the build.并 ...
