Hi Guys.
I have a solution that uses MEF plug ins. It consists of 3 projects.
1. The "engine" project. This does the actual work and consumes plugins to do so. It contains an interface that defines the contract a plugin should adhere to.
2. The plugin project where individual plug ins are implemented. This contain a reference to the engine project because it needs to access the plugin interface.
3. A UI project. This contains a reference to the engine project so it can call it's methods. It also contains some calls to the methods on the plugin interface but never addresses a concrete instance of a plugin. This is the start up project for the solution.
In design architecture terms this is all good and is giving me a nice separation of concerns. But, at present, the UI project also has a reference to the plug ins project which it shouldn't need as it never addresses anything concrete in that project. The only purpose the reference is serving is to force the plugins project to be built and copied locally to the bin debug folder for the UI project. I would like to separate this operation from the reference if possible - mostly because it'll force me to be disciplined and not address anything in the plug in project directly.
I have removed the reference and replaced it with a project dependency which successfully gets the plug in to build but does not result in it being copied to the UI projects bin debug folder, meaning that none of the plug ins are available at run time when debugging. Is there a way to do this?
I figure I can add a copy as post build action of the plug in project but this feels a bit flakey. The engine (and therefore the plugins) is designed to be consumable by multiple different UI's which would mean adding new copy actions as new UIs are implemented. It's also likely that other devs may work on this in the future and I can't guarantee that they will structure their repos in the same way as me so the relative paths may change.
What I'm really looking for is the ability to set CopyLocal on a dependency rather than a reference. Can anyone suggest a way of doing this? I was kinda expecting visual studio to support it somehow but I can't find an option for it.




Reply With Quote