I have a C# .Net 2.0CF application where I would like to load a .NET 'plug-in' DLL at runtime.
As I understand it, I should be able to use the System.Reflection.Assembly.LoadFrom()
to load the DLL to an Assembly. Then use Assembly.GetTypes()
to get the list of types within the plugin to match them to my expected interfaces.
The problem is that when I call GetTypes()
, I get a System.TypeLoadException()
. Based on the exception message, I assume this is because this particular plugin references some other assembly that this program knows nothing about. But, that's part of the point of it being a plugin! I don't want my application to have to know anything about these other assemblies.
How can I load this plug-in DLL without having my application reference every assembly used in the plugin?
Thanks, PaulH