let me try to explain my problem. I'm currently trying to develop a small "plugin-framework" written in .Net (mainly for experimenting a bit). So the idea is to have a main application to which "plugins" can be added by deploying dlls in a specific folder "plugins" of the main application. Everything works fine, the plugins are instantiated properly, however now I'm facing a problem. I have deployed now a plugin "X" that uses additional 3rd-party plugins and so now I have the problem that these additional 3rd-party plugins required by "X" are not found at run-time. My idea is therefore now to add an additional directory "dependencies" where I also deploy all of the needed plugins.
So my first question: How can I load the assemblies into the application domain (given that I know the path to them) s.t. they can be used by my application?
I tried to approach that by doing something like:
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
//find the path to the assembly and then load and return it by
//return Assembly.Load("pathToDependencies/failedAssembly.dll");
}
The problem is that this event-handler now gets activated having the "Presentation.Zune.dll" in the args variable (I'm using a WPF app). It seems as if that assembly failed loading but the actual problem is another dll.
Can someone suggest me a better way to solve my problem? I hope that I was able to explain my situation sufficiently, otherwise just ask for further clarification.
Thanks, Juri
You can set the probing path of the runtime so it can find the assemblies. Set the probing element in your apps config file.
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="plugins;dependencies"/>
</assemblyBinding>
</runtime>
</configuration>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With