locked
MEF not loading the extension dll RRS feed

  • Question

  • Hi All,

    I am working on my first MEF project. I created 2 exports of type IContactTool which are in different project but in same solution as my main application. These exports are complied into same dll and I am able to import these in my main application.

    The problem is I a new extension using same contract IContactTool which is in a new project in same solution. MY application is loading the exports from 1st dll but its not loading the export from 2nd dll. Both the extension project compiles at same location, still my application is not loading the 2ne export?

    Following is the code for Importing the extensions

    [ImportMany(typeof(IContactTool))]
    public IEnumerable<IContactTool> ContactTools { get; set; }

    What could be the reason for this?

    Any help is really appreciated. Many Thanks!

     

    Thursday, November 18, 2010 9:58 PM

All replies

  • There are a lot of things that could be wrong.  Read my blog post on this topic for the types of issues that could be causing them and how to diagnose and fix them: How to Debug and Diagnose MEF Failures

    Thanks,
    Daniel

    Monday, November 29, 2010 11:33 PM
  • See thi

    http://mef.codeplex.com/Thread/View.aspx?ThreadId=237876


    Não esqueça de usar o componente </> na barra para posta seu código.
    • Proposed as answer by Ganesh_shiv Wednesday, December 22, 2010 5:03 AM
    Tuesday, December 21, 2010 2:24 PM
  • I think your IEnumerable<IContaactTool> is not recomposing. Just add AllowRecomposition=True. That way all exports will get captured.

    [ImportMany(typeof(IContactTool), AllowRecomposition=True)]
    public IEnumerable<IContactTool> ContactTools { get; set; }
    
    Hope this helps.

     


    S.Ganesh
    • Proposed as answer by Ganesh_shiv Wednesday, December 22, 2010 5:06 AM
    Wednesday, December 22, 2010 5:05 AM