I have a MEF console application that hosts a host ( CompositionContainer
), from which available plug-in assemblies are loaded based on a command line parameter, for example:
app.exe plugin1
load host (app.exe) and plugin1. VS solution is structured in such a way that each plugin has its own project (hence its own assembly).
There is a set of plugins, some of which have the ability to reuse code. So, for example, plugin1
has the CopyFiles(string fileName)
method and plugin2
should use the same functionality.
Now, in a traditional console application, you add a link to plugin1.dll
and, using this namespace, get down to business with reuse.
I'm curious if there is a βMEFβ way, if you want, to implement this reuse. So, something like creating a plugin1
object in plugin2
, adding the Import
attribute to plugin1's
export interface and letting MEF take care of the rest. Is it possible? And if so, how?
Or is there a better approach to take when developing such applications? A voodoo bonus for any pointers to useful training resources and explanations.
Thanks!
source share