[ACCEPTED]-Reflection.Net: how to load dependencies?-add-on
If MyTools.dll is located in the same directory as 3 Addon.dll, all you need to do is call
Assembly.LoadFrom instead of 2
Assembly.LoadFile to make your code work. Otherwise, handling 1 the
AppDomain.AssemblyResolve event is the way to go.
Couple of options:
- You can attach to
AppDomain.AssemblyResolveto help the CLR resolve the assembly.
- You could look into isolating add-ins into their own
System.AddInnamespace and this website).
Have you looked into using an Inversion Of Control container? I 4 use Castle Windsor with an external Boo 3 file that lets me easily extend the applcation 2 without having to recompile or worry about 1 supplying dependencies
You can use reflection to access the private 6
Although, the method could change in a future 5 version of the .NET framework, it doesn't 4 seem likely—ASP.NET heavily depends on it, though 3 it's possible they could move it from
mscorlib to 2
System.Web which is the only assembly that I know 1 of from where the method is referred to.
Assembly.LoadFrom works well until I try 4 to use a webService in my addon, I had had 3 a "Unable to cast object of type 'X' to type 'X'" exception.
It's ugly, but i will use 2 Assembly.LoadFile with the AppDomain.AssemblyResolve.
Thanks 1 guys.
More Related questions