.NET Framework各版本汇总以及之间的关系

.NET Framework

.NET版本1.01.12.03.03.54.04.5
完整版本1.0.3705.01.1.4322.5732.0.50727.423.0.4506.303.5.21022.84.0.30319.14.5.40805
发布时间2002-02-132003-04-242005-11-072006-11-062007-11-192010-04-122012-05-24
VS开发版本VS2002VS2003VS2005 VS2008VS2010VS2012
Windows默认安装 Windows Server 2003Windows Server 2003
Windows Server 2008
Windows Vista
Windows Server 2008
Windows 7
Windows Server 2008 R2
 Windows 8
Windows Server 2012
下载.NET Framework 1.0 (SP3).NET Framework 1.1 (SP1).NET Framework 2.0 (SP2).NET Framework 3.0 (SP2).NET Framework 3.5 (SP1).NET Framework 4.0.NET Framework 4.5
说明Microsoft Internet Explorer 5.01 或更高版本Microsoft Internet Explorer 5.01 或更高版本Windows Installer 3.1 或更高版本 Internet Explorer 6.0 或更高版本 包括 .NET Framework 2.0 Service Pack 2 和 .NET Framework 3.0 Service Pack 2 累积更新Windows Installer 3.1 或更高版本 Internet Explorer 5.01 或更高版本.NET Framework 4.5 RC 是一个针对 .NET Framework 4 的高度兼容的就地更新。
支持的windows版本Windows 98
Windows NT
Windows Server 2000
Windows Server 2003
Windows XP
Windows Server 2000
Windows Server 2003
Windows XP
Windows Server 2003
Windows XP
Windows Server 2003Windows Server 2003
Windows Server 2008,
Windows Vista
Windows XP
Windows XP SP3
Windows Server 2003 SP2
Windows Vista SP1
Windows Server 2008
Windows 7
Windows Vista SP2
Windows 7
Windows 8
Windows Server 2008
Windows Server 2012

版本关系

.NET Framework 版本 2.0、3.0 和 3.5 是使用 CLR (CLR 2.0) 的相同版本生成的。 每个版本增量地生成于早期 .NET Framework 版本。 在计算机上不可能并排运行版本 2.0、3.0 和 3.5。 在安装 .NET Framework 3.5 SP1 时,会自动安装 2.0 和 3.0 层。 但是,.NET Framework 4 关闭此分层方法。 以 .NET Framework 4 开始,可使用进程内并行承载来在单独的进程中运行多个公共语言运行时 (CLR) 版本。 Apps 的 2.0 ,3.0 和 3.5 版本可以全部在 3.5 版运行,但是,它们在 4 版或更高版本将不起作用。.NET Framework 4.5 是就地更新,替换您的计算机上的 .NET Framework 4。 在安装此更新后,您的 .NET Framework 4 应用程序在无需重新编译的情况下应继续运行。 但是,.NET Framework 中的某些更改可能需要更改您的应用程序代码。 有关更多信息,在 .NET Framework 4.5 中运行现有应用程序前,请参见 在 .NET Framework 4.5 中的应用程序兼容性。 有关安装当前版本的更多信息,请参见 安装 .NET Framework 4.5。 有关对 .NET Framework 的支持的信息,请参见 Microsoft 支持网站上的 Microsoft .NET Framework Support Lifecycle Policy(Microsoft .NET Framework 支持生命周期策略)。
 
以上是微软官方解释。
我理解的意思是,3.5包含了2.0和3.0,安装了3.5就自动安装了2.0和3.0。这样也说明了为什么3.5的安装包会很大的原因。win7以后好像就不能直接安装2.0只能通过安装3.5来支持2.0的程序。
4.0是一个过渡版本,安装4.5是会覆盖4.0。并且4.0可在4.5环境中运行。
值得注意的是4.5不支持XP系统了。

获取.NET框架版本

using System;
using Microsoft.Win32;
 
public class GetDotNetVersion
{
     public static void Main()
     {
         Console.WriteLine( ".NET框架版本:" );
         using (RegistryKey ndpKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, "" ).OpenSubKey( @"SOFTWARE\Microsoft\NET Framework Setup\NDP\" ))
         {
             foreach ( string versionKeyName in ndpKey.GetSubKeyNames())
             {
                 if (versionKeyName.StartsWith( "v" ))
                 {
 
                     RegistryKey versionKey = ndpKey.OpenSubKey(versionKeyName);
                     string name = ( string )versionKey.GetValue( "Version" , "" );
                     string sp = versionKey.GetValue( "SP" , "" ).ToString();
                     string install = versionKey.GetValue( "Install" , "" ).ToString();
                     if (install == "" ) //no install info, ust be later
                         Console.WriteLine(versionKeyName + "  " + name);
                     else
                     {
                         if (sp != "" && install == "1" )
                         {
                             Console.WriteLine(versionKeyName + "  " + name + "  SP" + sp);
                         }
                     }
                     if (name != "" )
                     {
                         continue ;
                     }
                     foreach ( string subKeyName in versionKey.GetSubKeyNames())
                     {
                         RegistryKey subKey = versionKey.OpenSubKey(subKeyName);
                         name = ( string )subKey.GetValue( "Version" , "" );
                         if (name != "" )
                             sp = subKey.GetValue( "SP" , "" ).ToString();
                         install = subKey.GetValue( "Install" , "" ).ToString();
                         if (install == "" ) //no install info, ust be later
                             Console.WriteLine(versionKeyName + "  " + name);
                         else
                         {
                             if (sp != "" && install == "1" )
                             {
                                 Console.WriteLine( "  " + subKeyName + "  " + name + "  SP" + sp);
                             }
                             else if (install == "1" )
                             {
                                 Console.WriteLine( "  " + subKeyName + "  " + name);
                             }
                         }
                     }
                 }
             }
         }
 
         Console.WriteLine();
         Console.WriteLine( "操作系统版本:" + System.Environment.OSVersion.ToString());
         Console.WriteLine( "当前.NET框架版本:" + System.Environment.Version.ToString());
         Console.ReadKey();
     }
}

参考资料

  • 6
    点赞
  • 32
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
以下是 VB.NET 中的文件操作函数的完整列表及其示例代码: 1. `File.Exists` - 检查文件是否存在 ``` Dim filePath As String = "C:\example.txt" If File.Exists(filePath) Then Console.WriteLine("File exists") Else Console.WriteLine("File does not exist") End If ``` 2. `File.ReadAllText` - 读取文本文件的内容 ``` Dim filePath As String = "C:\example.txt" Dim fileContents As String = File.ReadAllText(filePath) Console.WriteLine(fileContents) ``` 3. `File.ReadAllLines` - 读取文本文件的所有行 ``` Dim filePath As String = "C:\example.txt" Dim fileLines As String() = File.ReadAllLines(filePath) For Each line As String In fileLines Console.WriteLine(line) Next ``` 4. `File.ReadAllText` - 读取二进制文件的内容 ``` Dim filePath As String = "C:\example.bin" Dim fileBytes As Byte() = File.ReadAllBytes(filePath) For Each b As Byte In fileBytes Console.Write(b & " ") Next ``` 5. `File.WriteAllText` - 创建一个新文件并向其中写入文本 ``` Dim filePath As String = "C:\example.txt" Dim fileContents As String = "Hello, world!" File.WriteAllText(filePath, fileContents) ``` 6. `File.WriteAllLines` - 创建一个新文件并向其中写入多行文本 ``` Dim filePath As String = "C:\example.txt" Dim fileLines As String() = {"Line 1", "Line 2", "Line 3"} File.WriteAllLines(filePath, fileLines) ``` 7. `File.WriteAllBytes` - 创建一个新文件并向其中写入二进制数据 ``` Dim filePath As String = "C:\example.bin" Dim fileBytes As Byte() = {1, 2, 3, 4, 5} File.WriteAllBytes(filePath, fileBytes) ``` 8. `File.AppendAllText` - 向现有文件中追加文本 ``` Dim filePath As String = "C:\example.txt" Dim fileContents As String = "New line of text" File.AppendAllText(filePath, fileContents) ``` 9. `File.AppendAllLines` - 向现有文件中追加多行文本 ``` Dim filePath As String = "C:\example.txt" Dim fileLines As String() = {"Line 4", "Line 5", "Line 6"} File.AppendAllLines(filePath, fileLines) ``` 10. `File.Copy` - 复制文件 ``` Dim sourcePath As String = "C:\example.txt" Dim destinationPath As String = "C:\example_copy.txt" File.Copy(sourcePath, destinationPath) ``` 11. `File.Move` - 移动文件 ``` Dim sourcePath As String = "C:\example.txt" Dim destinationPath As String = "C:\ExampleFolder\example.txt" File.Move(sourcePath, destinationPath) ``` 12. `File.Delete` - 删除文件 ``` Dim filePath As String = "C:\example.txt" File.Delete(filePath) ``` 这些是 VB.NET 中可用的文件操作函数及其示例代码。请注意,这些函数不是全部的文件操作函数,但是它们涵盖了大部分常见的文件操作需求。如果您需要执行更高级的文件操作,请查看 .NET Framework 中其他的文件操作类和函数。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值