C# – MEF: ComposeParts missing

cmefnet

I am trying to follow some starter guides for using MEF in .Net 4, but I get stuck when I get to setting up the application. The instructions say to do this:

var catalog = new DirectoryCatalog(@".\");
var container = new CompositionContainer(catalog);
container.Composeparts(this);

But the version of System.ComponentModel.Composition included with .Net 4 doesn't seem to have the Composeparts method available on CompositionContainer, and I am unable to find a good reference on how to do this in the current system.

Here is the reference I am currently using:
Building Composable Apps in .NET 4 with the Managed Extensibility Framework

Does anyone out there have a better reference that I should be looking at?

Best Answer

The CompositionContainer does have a ComposeParts method, as an extension method.

See this reference for some working code.

Related Topic