.net解决方案中如何有两个项目一个针对4.0框架,另一个针对4.5框架? [英] How to have two project in .net solution one targeting 4.0 framework and other one 4.5 framework?

查看:45
本文介绍了.net解决方案中如何有两个项目一个针对4.0框架,另一个针对4.5框架?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用.Net 4.5功能的模块,我们的应用程序也适用于XP用户.因此,我正在考虑将依赖于.net 4.5的模块移至单独的项目.我如何有一个解决方案,其中有两个针对不同版本的项目?

I have a module which is using .Net 4.5 features and our application works for XP users also. So I was thinking of moving this .net 4.5 dependent module to separate project. How can I have a solution which is having two projects targeting to different version?

推荐答案

解决方案中的每个项目都针对特定版本的.NET,因此没有什么特别的,但是请参考.NET 4.0项目中针对.NET 4.5的项目/模块.

Each project in a solution is targeting it's specific version of .NET, so there is nothing special to that, BUT you can NOT reference that project/module targeting .NET 4.5 from the .NET 4.0 project.

如果您需要将.NET 4.5定位为某个模块,则主应用程序也必须以.NET 4.5为目标,因此,如果无法解决这些功能,则需要放弃XP支持,这与XP一样,IMO也不是一件坏事.不再受支持的操作系统.

If you need to target .NET 4.5 for some module your main application must also target .NET 4.5, so if there is no way around that features you need to ditch XP support, which is IMO not a bad thing as XP is not a supported OS anymore.

如果.NET 4.5中的功能是 async / await -功能,则可以使用

IF that feature from .NET 4.5 is the async/await-feature you could use the Microsoft.Bcl.Async-package an keep targeting .NET 4.0...

这篇关于.net解决方案中如何有两个项目一个针对4.0框架,另一个针对4.5框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆