Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does MEF require .NET 4?

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?

like image 489
Alan Avatar asked May 11 '10 14:05

Alan


People also ask

Is MEF supported in .NET core?

For those who don't know, the Managed Extensibility Framework (MEF) is alive and well, and has been ported to . NET Core as System. Composition (source here).

What is MEF Visual Studio?

Overview of the Managed Extensibility Framework. The MEF is a . NET library that lets you add and modify features of an application or component that follows the MEF programming model. The Visual Studio editor can both provide and consume MEF component parts.

Is MEF dependency injection?

MEF is more than just dependency injection techniques. It is used wherein we need a plugin-based architecture for our application, but at the same time MEF uses an IoC-based approach for dependency injection.


2 Answers

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.

like image 139
DannyLane Avatar answered Oct 18 '22 12:10

DannyLane


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.

like image 9
B.Mo Avatar answered Oct 18 '22 13:10

B.Mo