1

I have a few class libraries that I'm using in two of our in-house projects. One of the in-house projects targets the .NET 4.0 framework, while the other one targets .NET 2.0. I'm using LinqBridge to gain some of the niceties of the higher version .NETs in the 2.0 project.

In order to use the class libraries properly in both projects, I need to compile one version (using LinqBridge) to the .NET 2.0 Framework, and another version (using the standard System.Linq) for .NET 4.0.

I'd like to avoid doing this manually every time. I was hoping there was a way to specify what the current target framework is in the Build Events section, but it looks like there isn't a macro for that. I'm generally unfamiliar with manually editing build configurations. What's the right way to go about targeting two frameworks for a single project?

4

1 回答 1

6

我只需在一个解决方案中创建两个单独的项目,一个用于 2.0,一个用于 4.0 目标。他们可以引用相同的源文件,而 2.0 可以添加所需的额外引用。

这将允许您构建解决方案并让 2.0 和 4.0 目标 DLL 包含在您需要的任何其他项目中。

于 2013-03-26T19:17:03.853 回答