Hello,
I have written a plugin solution for ASP MVC applications based on the advice found on this site, however, I have reached a roadblock and would appreciate some help. Without going too deep into how the plug-in system works, it does successfully load the controller and finds its appropriate view - the problem is that the view does not compile because it cannot resolve all the plugin's references (the plugin DLL has references to other DLL's that the host application doesn't know about).
I am using AssemblyResolve on the CurrentDomain but that doesn't get called when the default BuildManager is compiling the view, instead, it takes the list of assemblies from the web.config section. If I add all the plugin files to the GAC and add a reference in that section - it works fine. But that defeats the purpose of having a plugin system if I have to change web.config for every plug-in.
A little illustration to explain the issue: Plugin.dll --references--> PluginServices.dll
URL http://mysite.com/some/index MVC Application --load--> Plugin.dll PASS
MVC Application --load--> Plugin.SomeController PASS
MVC Application --find--> Plugin\Views\Some\Index.aspx PASS
MVC Application --compile--> Index.aspx FAIL (the view uses a type from PluginServices which cannot be found)
Is there a way to dynamically add references to BuildManager so that the compilation passes without changing web.config?
Thanks in advance!