Hi all, I've been googling a lot about this but it seems there is no up-to-date solution (e.g. see here
]). Basically I'd like to build an MVC 4 web app acting as a host for plugins. Each plugin should expose controllers (exported via MEF into their DLL) plus content files (views and the like), that I'll just copy in the web host during plugin installation. Plugins should be loaded dynamically via MEF, and it should be possible to add them without having to restart the web app.
I thus need:
* a MEF-aware IoC tool for non-trivial injections (for basic duties I could just rely on MEF itself). I chose Autofac, which has a MEF-adapter easily installable from NuGet and up to date for MVC4.
* a MEF-based controller factory, to let my web app find the controllers exported by plugins. See this post
] for a good sample, also integrated into a NuGet package.
* a shadow plugins folder to load my plugins from (using a MEF DirectoryCatalog). On startup the application copies all the plugins DLLs from the Plugins folder to a shadow subfolder and let the MEF catalog point to them, so that I can later overwrite the plugins without being blocked by file locks.
After putting all these pieces together, I found that my MEF controller factory always gets a null controllerType from the MVC framework, so it fails even before it can execute. I suspect some kind of namespace-related issue here, but I don't know MVC internals enough. You can download a full dummy repro solution from here
]. I'm stuck with this, could anyone help? It should not be so hard integrating MVC+MEF...