简体   繁体   English

.net解决方案中如何有两个项目一个针对4.0框架,另一个针对4.5框架?

[英]How to have two project in .net solution one targeting 4.0 framework and other one 4.5 framework?

I have a module which is using .Net 4.5 features and our application works for XP users also. 我有一个使用.Net 4.5功能的模块,我们的应用程序也适用于XP用户。 So I was thinking of moving this .net 4.5 dependent module to separate project. 因此,我正在考虑将依赖于.net 4.5的模块移至单独的项目。 How can I have a solution which is having two projects targeting to different version? 我如何有一个解决方案,其中有两个针对不同版本的项目?

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,因此没有什么特别的, 但是您不能从.NET 4.0项目中引用针对.NET 4.5的项目/模块。

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定位为某个模块,则主应用程序也必须以.NET 4.5为定位,因此,如果无法解决这些功能,则需要放弃XP支持,这对IMO来说不是一件坏事,因为不支持XP操作系统了。

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... IF从.NET 4.5该功能是async / await -feature您可以使用Microsoft.Bcl.Async -package的继续指定.NET 4.0 ...

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM