混合.NET 3.5与4 / 4.5组件在同一个解决方案/项目 [英] Mixing .NET 3.5 with 4/4.5 assemblies in the same solution/project

查看:454
本文介绍了混合.NET 3.5与4 / 4.5组件在同一个解决方案/项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,大多数项目在.NET 4.5(我使用异步和任务)都编制了解决方案。照片 有几个需要在.NET 3.5编译,因为它们使用只支持.NET 3.5 SDK的项目。
如果我的共同项目被编译在4.5和我有一个目标框架3.5,需要它,是否有可能添加引用一个共同的项目? (例如,我的记录器接口是常见的,我得到它与DI)。

感谢。

输出:

 无法得到解决,因为它是建立在对.NETFramework,版本= V4.5的框架。这是一个更高的版本比当前目标框架.NETFramework,版本= 3.5版。
 

解决方案

由于编译器会告诉你,那是不可能的。您可以尝试你的公共图书馆分为两个部分,一个专为4.5,另一个为3.5框架。

I have a solution that most projects are compiled in .net 4.5 (I use async and tasks).
There are couple of projects that need to be compiled in .net 3.5 since they use SDK that support only .net 3.5.
If my "Common" project is compiled in 4.5, and I have a project with target framework 3.5 that needs it, Is it possible to add reference to the Common ? (e.g my logger interface is at Common and i get it with DI).

Thanks.

Output:

could not be resolved because it was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v3.5".

解决方案

As the compiler tells you, it is not possible. You can try to split your "Common" library into two parts, one built for 4.5 and another for 3.5 framework.

这篇关于混合.NET 3.5与4 / 4.5组件在同一个解决方案/项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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