none
MEF how to get type of a composable part at design time without refrence to the assembly RRS feed

  • Question

  • Hey there,

    its maybe a trivial question but Im knda stuck on that issue, so my question is:

    When I use the MEFBootstaper to discover my asseblies and I know he is getting the stuff I expect how do I get to use it at design time? I have a simple Interface that exposes a Name property and my plugin implemts this interface. So far everything as expected, I export stuff on the plugin dll and import ... works as well but here is the frustrating part. I have a Host app that has no reference to the  Interface definition so at design time I cant do stuff like this

    [ImportMany ( typeof ( IPlugin) , AllowRecomposition = true )]
            private IEnumerable<Lazy<IPlugin>> plugins;

    because there is no refrence to IPlugin in that project. So is there a way of getting that to work without adding a refrence at design time?  In my opinion there should be a way or the whole idea of decoupling something gets a kinda corrupted and I could just add the plugin to the solution.  Some advice on this would be very helpful.

    regards 

    Markus

    Tuesday, October 15, 2013 11:31 AM

Answers

  • I think I found the answer myself, well I was aware of it somehow but though it could be archived in a different way

    http://stackoverflow.com/questions/10254782/explain-how-mef-doesnt-have-hard-dependency-on-assemblies

    its no biggy I'll add the ref to my common dll and should be fine 

    • Marked as answer by Markus Ro Tuesday, October 15, 2013 11:51 AM
    Tuesday, October 15, 2013 11:51 AM