I have a problem with my dll-files. I’m writing a program which can be extended with some plugins. I use an interface for these plugins and I can read and use them in my program. Each plugin contains a serializable class, which contains some simple fields.
I can serialize these classes with a binary-formatter and save them to disk. But when I try to deserialize my saved file, I get an exception: “The assembly … can not be found”.
Where do I have to register my dll-plugins so that my programm can find the assembly?
Thanks for help!
First of all, I highly recommend using MEF for plugin, it is part of .NET 4.0.
On the other hand, DLLs are loaded from bin folder. If you put them anywhere else they cannot be found. Now if you still insist having a “plugin” subfolder inside your bin, then you may manually load the assemblies at the startup by using
Assembly.LoadFile.