C# 如何将 .Net Framework 从 3.5 版更改为 4.0 版
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10877913/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I change the .Net Framework from version 3.5 to version 4.0
提问by Running Rabbit
I have created a class library in .NET Framework 3.5. Now I want to change the .NET Framework Version to 4.0.
我在 .NET Framework 3.5 中创建了一个类库。现在我想将 .NET Framework 版本更改为 4.0。
How can I do this?
我怎样才能做到这一点?
回答by Nikhil Agrawal
Unfortunately this cannot be done once dllhas been created. For this you need to have source of your class library.
不幸的是,一旦dll创建就无法做到这一点。为此,您需要拥有类库的来源。
Select Propertiesfrom Right clicking on the project in the solution explorer.
In Application Tabchange Target Frameworkto Desired one.
右键单击解决方案资源管理器中的项目,选择“属性”。
在应用程序选项卡中,将Target Framework更改为Desired one。
回答by Eric J.
In Visual Studio:
在 Visual Studio 中:
- Right-click on your project
- Select Properties
- Select the Application tab
- Change the Target Framework to the desired framework
- 右键单击您的项目
- 选择属性
- 选择应用程序选项卡
- 将目标框架更改为所需的框架
If you are not seeing .NET Framework 4as 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重新编译。
回答by Martin Liversage
Right click on the project in the solution explorer and select Properties.
Make sure that the Applicationtab is selected.
In the Target frameworkdropdown select the desired framework, e.g. .NET Framework 4.
右键单击解决方案资源管理器中的项目并选择Properties。
确保选择了应用程序选项卡。
在目标框架下拉列表中选择所需的框架,例如.NET Framework 4。
回答by timB33
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(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 中一次完成一个项目是不切实际的。
回答by mathias.horn
In Visual Studio 2010:
在Visual Studio 2010 中:
- Right-clickon your Project
- Select Properties
- Select the Compiletab
- At the bottom, select Advanced Compile Options
- Change the Target Frameworkto the desired framework
- 右键单击您的项目
- 选择属性
- 选择编译选项卡
- 在底部,选择高级编译选项
- 将目标框架更改为所需的框架

