由.net framework 3.5切换.net framework 4.5遇到的问题

  • 背景

由于server 2012 r2安装.net framework3.5需要安装光盘。Scott提出需要把旧项目.net framework升级。不再需要安装.net framework3.5。旧的系统使用.net framework4的离线安装包即可,总之避免使用安装光盘。

所以需要把一个基于.net framework3.5开发的软件,使用.net framework 4.5重新编译一次。

原有这个项目是windows xp+VS2008+.net framework开发的。新的项目都使用的WIN7+VS2010+C++进行开发的。所以希望在WIN7上安装.net 4.5,继续使用VS2010进行编译就可以了。

结果遇到了两个问题或者疑问。

 

  • 问题1:安装了.net 4.5,但VS2010无法选择.net4.5。

Stackoverflow有两个人的回答如下:

  1. Each version of Visual Studio prior to Visual Studio 2010 is tied to a specific .NET framework. (VS2008 is .NET 3.5, VS2005 is .NET 2.0, VS2003 is .NET1.1) Visual Studio 2010 and beyond allow for targeting of prior framework versions but cannot be used for future releases. You must use Visual Studio 2012 in order to utilize .NET 4.5.
  2. You must upgrade to Visual Studio 2012 for .NET v4.5 support.
  3. 另外在百度上看到一张图片,显示了visual studio与.net framework之间的关系:

版本

完整版本号

发行日期

Visual Studio

Windows 默认安装

1.0

1.0.3705.0

2002-02-13

Visual Studio .NET 2002

Windows XP Media Center Edition

Windows XP Tablet PC Edition

1.1

1.1.4322.573

2003-04-24

Visual Studio .NET 2003

Windows Server 2003

2.0

2.0.50727.42

2005-11-07

Visual Studio 2005

 

3.0

3.0.4506.30

2006-11-06

 

Windows Vista

Windows Server 2008

3.5

3.5.21022.8

2007-11-19

Visual Studio 2008

Windows 7

Windows Server 2008 R2

4.0

4.0.30319.1

2010-04-12

Visual Studio 2010

 

4.5Beta

4.5.50501.17626

     

4.5

4.5.40805

2012-02-20

Visual Studio 2012 RC

Windows 8

Windows Server 2012

4.5.1

4.5.50938.18408

   

Windows 8.1

Windows Server 2012 R2

4.5.2

4.5.51209.34209

     

4.6

4.6.00081.00

2015-7-26

Visual Studio 2015

Windows10

4.6.1

4.6.01055.00

   

Windows10November 2015 Update

4.6.2

4.6.01590.00

     

4.7

4.7.2053.0

2017-5-2


 

 

 

  • 问题2:为什么以前基于windows xp +vs2008+.net framework3.5编译的软件,无法在自带.net framework 4的server 2012 r2上运行。.net framework的各个版本之前的兼容性是什么样子的?

在CSDN查到一篇类似的文章:https://blog.csdn.net/cnhk1225/article/details/46983209.大意如下:

Net版本之间是有一定联系的,目前为止微软推出了3个版本的CLR,分别是 1.1, 2.0 , 4.0 并且你要注意的是 .Net 4是基于CLR4的,而.Net 2.0 3.0 3.5都是基于 CLR2.0, 3.0 3.5其实只是在2.0的基础上增加了新的功能,并没有改变CLR。 http://msdn.microsoft.com/zh-cn/library/bb822049.aspx

所以,一旦有程序需要CLR2.0环境,你就需要安装 2.0 3.0 或者 3.5。 建议是安装3.5, 因为这样就已经包含了2.0 3.0 的所有内容;而4.0是需要独立安装的。

CLR2.0 和 CLR4.0安装顺序没有要求,所以你只需要一次性安装一个 .Net 3.5 SP1 和 .Net 4.0 就可以了.

 

 

猜你喜欢

转载自www.cnblogs.com/iamkun2005/p/9114061.html