This project has moved and is read-only. For the latest updates, please go here.

Import and Export Attributes for .NET 2.0

Apr 25, 2011 at 9:51 AM


At this time I develop an application for .NET 2.0. I know MEF is developed for .NET4.0.

Now my question, is it possible to split the framework in two parts? The first part with the ComositionContainer and the providers use .NET 4.0. And the second part (.NET 2.0) includes only the definition attributes for import and export. I know it is impossible to change the .NET framework 2.0, but maybe it is possible create a additional .NET project with the same attributes?!

Best regards jan

Apr 25, 2011 at 6:44 PM


It is possible to use Postsharp Aspects l(that use .NET 2.0) ike I wrote on my blog entry:

I use ConcrrentDictionary that is in .NET 4.0, but you can simply change that implementation of IDictionary<TKey, TValue> to stadard Dictionary<TKey, TValue>. That will be easy to change to .NET 2.0.

Is that is helpful for you?

Regards, Piotr

Apr 27, 2011 at 10:32 AM

Hi Piotr,

thank you for your reply. Postsharp has to be installed for developing! Because of this, I don't want to use Postsharp.

Apr 27, 2011 at 10:51 AM

Hi schubertj,

It is always possible to prepare LocationInterceptionAspect equvalent with a property descriptor that you can use in developing (becouse of slower reflection) and on a build server you can have the PostSharp and build your solution fastest as it can be without reflection. Bu of course it is your software desing decision Solution with PostSharp is only an idea :).

Regards, Piotr