Answered MEF in WPF using VS2010 Beta 2

  • Monday, January 25, 2010 3:03 PM
     
     

    I have managed to setup a project with MEF with Silverlight using the Silverlight SDK. I would like to do exactly the same but with a WPF application.

    Unfortunately the .net assemblies that come with vs2010 Beta 2 do not include System.ComponentModel.Composition.Initialization.dll. When I try to use the DLLs from the Silverlight SDK in a WPF application I get a System.Windows.Markup.XamlParseException.

    Does anyone know where I can download System.ComponentModel.Composition.Initialization.dll for non Silverlight applications in .Net 4.0?

    Thanks...

    Nigel...

Answers

  • Tuesday, February 02, 2010 1:54 PM
     
     Answered

    Hallo Everyone,

    Just in case someone else has this problem the solution was to create the container by hand:

    have fun

    Nigel...

        public Test()
            {
                InitializeMef();

            }

            private void InitializeMef()
            {
                DirectoryCatalog directoryCatalog = new DirectoryCatalog(@".");
                CompositionBatch batch = new CompositionBatch();
                batch.AddPart(this);
                CompositionContainer container = new CompositionContainer(directoryCatalog);
                container.Compose(batch);
            }

    • Marked As Answer by Nigel Findlater Tuesday, February 02, 2010 1:54 PM
    •