Late loading .ll plugin dll

I have a C # .Net 2.0CF application where I would like to load the .NET plug-in. NET module at runtime.

As I understand it, I have to use the System.Reflection.Assembly.LoadFrom()DLL to load the assembly. Then use Assembly.GetTypes()to get a list of types in the plugin so that they match my expected interfaces.

The problem is that when I call GetTypes(), I get a System.TypeLoadException(). Based on the exception message, I assume that this is due to the fact that this particular plugin refers to another assembly that this program knows nothing about. But, this part of the point is a plugin! I do not want my application to know anything about these other assemblies.

How to download this pluggable DLL without having an application link for each assembly used in the plugin?

Thanks PaulH

+3
source share
1 answer

The situation is not that your application should reference every assembly that the plug-in uses. The plugin refers to another DLL, not your application, and the plugin should be β€œinstalled” (perhaps just placed in a directory) along with everything it needs. It's unavoidable.

+2
source

Source: https://habr.com/ru/post/1735665/


All Articles