Hi all,
I am dealing with MEF for quite a while now and was quite pleased with it.
Since now I used a DirectoryCatalog that loaded dll's following a specific naming convention (all dll's/exe's etc in the same folder).
Now I get the chance to structure something equal in a different way, because I somehow felt dirty in the past putting everything into a single folder.
I thought about having the following structure for the new project (I use [xxx] for folders):
[MainApplication]
...MainApplication.exe
...[lib]
......ContractsLibrary.dll
...[plugins]
......[HelloWorldPlugin]
.........HelloWorld.exe
MainApplication.exe contains the PluginManager, which iterates over the [plugins] folder and creates a DirectoryCatalog for each subfolder and then creates the related CompositionContainer.
It references the ContractsLibrary.dll in order to know about the contract that a plugin has to export.
HelloWorld.exe also needs to reference the ContractLibrary.dll in order to know about the contract it has to export.
During development both reference the ContractsLibrary.dll located in the [lib] folder having copy local set to false.
Actually the import doesn't work due to a FileNotFOundException that is thrown during composition of HelloWorld.exe (related to the ContractsLibrary.dll).
I solved this issue by implementing AssemblyResolve in MainApplication.exe that will use the ContractsLibrary.dll from the [lib] folder.
So this already sounds problematic, doesn't it?
Anyway, after having given this a try I am now searching for a more professional way to structure an application tha should be able to import plugins that share the same dll's (the ones in the [lib] folder).
What is a good way to structure a project fulfilling above mentioned needs?
If you have any questions regarding this question do not hesitate to ask and I'll try to clarify it...
Also, if you have a good read related to the topic at hand, just drop it in and I'll dig through it.
Any input is kindly appreciated,
best regards
Andy