简体   繁体   English

如何将.Net Framework从版本3.5更改为版本4.0

[英]How do I change the .Net Framework from version 3.5 to version 4.0

I have created a class library in .NET Framework 3.5. 我已经在.NET Framework 3.5中创建了一个类库。 Now I want to change the .NET Framework Version to 4.0. 现在,我想将.NET Framework版本更改为4.0。

How can I do this? 我怎样才能做到这一点?

In Visual Studio: 在Visual Studio中:

  1. Right-click on your project 右键点击您的项目
  2. Select Properties 选择属性
  3. Select the Application tab 选择应用程序选项卡
  4. Change the Target Framework to the desired framework 将目标框架更改为所需的框架

If you are not seeing .NET Framework 4 as an option there, ensure you have it installed. 如果没有在其中看到.NET Framework 4 ,请确保已安装。

EDIT 编辑

I don't think this is what you're asking, but for completeness, one can also point an existing DLL to a later version of the .NET Framework without recompiling using Binding Redirects . 我认为这不是您要的,但是为了完整起见,也可以将现有DLL指向.NET Framework的更高版本,而无需使用Binding Redirects重新编译。

  1. Right click on the project in the solution explorer and select Properties . 在解决方案资源管理器中的项目上单击鼠标右键,然后选择“ 属性”

  2. Make sure that the Application tab is selected. 确保已选择“ 应用程序”选项卡。

  3. In the Target framework dropdown select the desired framework, eg .NET Framework 4 . 在“ 目标框架”下拉列表中,选择所需的框架,例如.NET Framework 4

Unfortunately this cannot be done once dll has been created. 不幸的是,一旦创建了dll就无法完成此操作。 For this you need to have source of your class library. 为此,您需要具有类库的源代码。

  • Select Properties from Right clicking on the project in the solution explorer. 从解决方案资源管理器中的项目上单击鼠标右键,选择“ 属性 ”。

  • In Application Tab change Target Framework to Desired one . 在“ 应用程序”选项卡中,将“ 目标框架”更改为所需的 框架

FYI - there's a "Target Framework Migrator" extension tool for Visual Studio (2013, 2015) that will do all projects in your solution in one go. 仅供参考-Visual Studio有一个“ Target Framework Migrator”扩展工具(2013年,2015年),可以一次性完成解决方案中的所有项目。

I'm working on a solution at the moment with a 100+ projects in it and it's not practicable to do each project one at a time IMO. 我目前正在开发一个解决方案,其中包含100多个项目,而一次IMO进行每个项目都不可行。

In Visual Studio 2010 : Visual Studio 2010中

  1. Right-click on your Project 右键点击您的项目
  2. Select Properties 选择属性
  3. Select the Compile tab 选择编译选项卡
  4. At the bottom, select Advanced Compile Options 在底部,选择“ 高级编译选项”
  5. Change the Target Framework to the desired framework 目标框架更改为所需的框架

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 COM-Interop:将.NET Framework版本从2.0更改为4.0 - 我是否也应该更改Guids? - COM-Interop: Change .NET Framework Version from 2.0 to 4.0 - Should I change the Guids also? 在Entity Framework中从.net 4.5.2更改为4.0的版本问题 - Version issue with change from .net 4.5.2 to 4.0 in Entity Framework 从.NET 4.0项目创建.NET 3.5版本 - Creating a .NET 3.5 version from a .NET 4.0 project 如何在项目中更改.NET框架版本? - How do I change the .NET framework version on a project? .NET Framework 2.0 vs 3.5 / 4.0 ...使用旧版本有任何可能的优势吗? - .NET Framework 2.0 vs 3.5/4.0… any possible advantage to use the older version? 如何以编程方式将目标框架从项目/解决方案的4.0更改为3.5? - How can I progrommatically change the target framework from 4.0 to 3.5 of a project/solution? 如何更改sageframe的.net框架版本? - How to change .net framework version for sageframe? 检测框架版本3.5 - Detect framework version 3.5 我应该在C#程序中使用.NET Framework 3.5检测Windows 8.1的正确操作系统版本? - What should I do in my C# program to detect the correct OS version for Windows 8.1, using .NET Framework 3.5? 现在将.net Framework 3.5转换为4.0时,每当我尝试执行回发时,都会收到脚本错误 - Converted .net framework 3.5 to 4.0 now i get a scripting error whenever i try to do a postback
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM