Loading two versions of the same plugin using Silverlight / MEF
My script is a classic MEF script. There is a silverlight app and the app can download plugins on the fly to add functionality. Plugins can be created by third parties.
Now the problem occurs when different plugins and / or host application refer to different versions of the same assembly.
For instance:
-plugin A refers to version 1.0 of the silverlight plugin dll and plugin B refers to version 2.0 of the same DLL.
OR
-host app refers to version 1.0 of the reactive extension DLL and plugin C refers to version 2.0 of the same DLL.
This is the problem most likely to happen. The plugins and host should all be independent, but with this problem, I realize that this plugin may work for a while, and then I update the link to the host application or add a new plugin causing another plugin to break.
I have done some research on loading Silverlight Assembly and I believe that only one version of a given assembly can be loaded at a time. So I don't know how to deal with it.
Any ideas on this?
a source to share
You will need to control some of the plugins that the application can load and ensure that they work together if you want to make sure it works.
If you have two plugins that reference different versions of the same assembly, you can make both of them work as long as no changes are made to the assembly. First of all, make sure the newer version of the assembly is loaded, and then Silverlight will also use it for the plugin that references the older version of the assembly (note that the behavior of this loader is very different from how it works on the .NET desktop ).
If changes are broken in different versions of the referenced assembly, you cannot get both plugins to work.
a source to share