14

I am using Visual Studio 2010, try to create a MEF application. Does this require .NET 4.0 or can I target .NET 2.0?

Alan
  • 141
  • 1
  • 3

2 Answers2

11

Yes you do:

Application requirements change frequently and software is constantly evolving. As a result, such applications often become monolithic making it difficult to add new functionality. The Managed Extensibility Framework (MEF) is a new library in .NET Framework 4.0 that addresses this problem by simplifying the design of extensible applications and components.

From: http://mef.codeplex.com/

Edit: The question about targeting .net 2.0 is answered here:

http://mef.codeplex.com/Thread/View.aspx?ThreadId=54008

MEF is not supported on .NET 2.0 as it depends on LINQ and Expression trees. Currently we do not have a .NET 2.0 version of MEF planned.

DannyLane
  • 2,096
  • 1
  • 16
  • 17
  • I created a console application in Visual Studio 2010 using .net framework 3.5 and referred the System.ComponentModel.Composition v4.0.30319. But I'm not able to compile the project as it is honoring the reference and asking "Are you missing an assembly reference?". Any ideas? – NLV Jun 01 '11 at 12:59
  • You cannot build v3.5 targeted project with v4.0 assemblies. – Ludwo Oct 10 '12 at 08:16
9

Strictly speaking you don't have to have .Net 4.0 installed. You can use MEF with .Net 3.5 - if you reference System.ComponentModel.Composition.dll.

As DannyLane says, however, you do need the LINQ functionality so you can't target .Net 2.0.

B.Mo
  • 191
  • 6