tags:

views:

505

answers:

1

The Managed Extensibility Framework is both a stand-alone project (currently targetting .NET 3.5) and part of the .NET 4.0 framework.

Suppose I create assemblies targetting .NET 3.5 that contain MEF parts. These assemblies will reference the stand-alone version of System.ComponentModel.Composition.dll.

Now suppose I create a MEF-enabled application targetting .NET 4.0. This application will reference the System.ComponentModel.Composition.dll that comes with the .NET 4.0 framework. Will I be able to use the aforementioned MEF parts in this application?

+4  A: 

Unfortunately this will not work because you the 3.5 version of System.ComponentModel.Composition.dll can only be produced by building the codeplex drop and isn't signed by the same key as the official 4.0 version so the CLR will load both assemblies and treat the attributes as two different attributes. So assuming the application is using the .Net 4.0 version of System.ComponentModel.Compsition.dll and constructs the Catalog/Container it will only find parts that were marked with attributes from the .Net 4.0 version.

Wes Haggard