locked
"AttributedAssemblyPartCatalog" NOT found RRS feed

  • Question

  • Hello everyone,

    I am working on an MVVM-MEF application. I have added reference to System.ComponentModel.Composition.dll(referenced from .Net Framework version4) to my project, still ""AttributedAssemblyPartCatalog" is not getting  recognized? What could be the reason for this.

    Here is the copy of my compose() method.

    private void Compose()
            {
                var catalog = new AttributedAssemblyPartCatalog(Assembly.GetExecutingAssembly());  
                var container = new CompositionContainer(catalog.CreateResolver());
                container.AddPart(this);  
                container.Compose();

            }

    Friday, November 12, 2010 10:28 PM

All replies

  • The code you are trying to use is very old.  The APIs changed before the RTM version of MEF in .NET 4.  Here's what the body of the method should be using the current APIs:

    var catalog = new AssemblyCatalog(Assembly.GetExecutingAssembly());

    var container = new CompositionContainer(catalog);

    container.ComposeParts(this);

    Thanks,
    Daniel

    Monday, November 29, 2010 11:28 PM