结合2.0框架和4.0或更高的相同解决方案 [英] Combine 2.0 framework and 4.0 or higher same solution

查看:86
本文介绍了结合2.0框架和4.0或更高的相同解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨伙计们,这将是最简单的解决方法,以便将编写在4.0或4.5框架上的新代码(c#)添加到2.0框架中编写的现有大项目中,我希望迁移旧项目但我不允许,所以我不想在2.0上写代码,我的生活有多难,我将非常感谢你的帮助。



非常感谢。



Walter

Hi folks, which will be the simplest work around in order to add new code ( c# ) written on 4.0 or 4.5 framework to existing big project written in 2.0 framework, i wish migrate old project but i'am not allowed,so i don't want write code on 2.0, how difficult could be my life, i will appreciate your help.

Thanks very much.

Walter

推荐答案

您可以在2.0中引用3.X程序集,因为CLR是相同的:( CLR2。 0 的)。从2.0 / 3.X引用4.0不是这样,因为Framework 4.0+使用 CLR4.0



您可以定位框架4.0在同一解决方案中,在另一个项目中将Framework 2.0定位到另一个项目中



首先在Visual Studio 2008中启用并在VS2010中大大改进,它被称为多目标(点击阅读更多信息) [ ^ ]



另见 MSDN文章 [ ^ ]关于VS2012中的多目标





干杯,

Edo
You can reference 3.X assemblies in 2.0, because the CLR is the same: (CLR2.0). This is not true for referencing 4.0 from 2.0/3.X as Framework 4.0+ uses CLR4.0

You can target a framework 4.0 in one project while targeting Framework 2.0 in another in the same solution.

First enabled in Visual Studio 2008 and greatly improved in VS2010, it is called Multi-Targeting (click to read more about)[^]

See also MSDN article[^] about Multi-Targeting in VS2012


Cheers,
Edo


你不能。您可以将V2组件添加到V4项目,但不能将V4组件添加到V2项目。您将不得不为V2编写,或者设计一种机制,使它们成为相互通信的独立解决方案。



为V2编写更容易......并且有可能是你不允许迁移的一个很好的理由:像.NET 2是目标PC上允许的最新框架,所以你的V4代码无论如何都不会工作......
You can't. You can add V2 components to a V4 project, but you can't add V4 components to a V2 project. You will have to write for V2, or work out a mechanism where they become separate solutions which inter-communicate.

Writing for V2 is easier...and there is probably a good reason why you aren't allowed to migrate: like .NET 2 is the latest framework allowed on the target PC, so your V4 code wouldn't work anyway...


这篇关于结合2.0框架和4.0或更高的相同解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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