Converting Between Types
-
I'm having a problem with a program I'm working on, which uses plugins. -The plugin is declared on one Assembly, as a class. -Other plugin assemblies have classes that inherit from this plugin. -The main application loads all assemblies in the root dir, and loads classes with the BaseType name of the plugins name. Now when I try to load the plugins, they can't be converted to the plugin type! It seems that the base type and the plugin type are different, but I know they aren't. I even checked to see if the GUID is the same. Anyone know what I'm doing wrong here? I'm pretty stuck, and can't go on with this project if I can't find a way out :(
All your source are belong to us!
-
I'm having a problem with a program I'm working on, which uses plugins. -The plugin is declared on one Assembly, as a class. -Other plugin assemblies have classes that inherit from this plugin. -The main application loads all assemblies in the root dir, and loads classes with the BaseType name of the plugins name. Now when I try to load the plugins, they can't be converted to the plugin type! It seems that the base type and the plugin type are different, but I know they aren't. I even checked to see if the GUID is the same. Anyone know what I'm doing wrong here? I'm pretty stuck, and can't go on with this project if I can't find a way out :(
All your source are belong to us!
Instead of using a BaseType Class that they must inherit from, have you tried specifying an Interface that they must implement?
-
Instead of using a BaseType Class that they must inherit from, have you tried specifying an Interface that they must implement?
The problem has been resolved. By the way, I couldn't use an interface, like all the normal examples on the net, because my plugin object has to inherit from another object and it has to have custom code in order for the plugins to work properly. This is why I could not use an interface.
All your source are belong to us!
-
The problem has been resolved. By the way, I couldn't use an interface, like all the normal examples on the net, because my plugin object has to inherit from another object and it has to have custom code in order for the plugins to work properly. This is why I could not use an interface.
All your source are belong to us!
Well you can inherit from some class and still implement another interface.
-
Well you can inherit from some class and still implement another interface.
-
Well you can inherit from some class and still implement another interface.
Let me make myself a bit more clear: I have 38 plugins already built, which implement this class. I worked a long time on them, and they are all working perfectly, so a complete redesign would make me have to strangle myself. Turns out the problem was that I had two copies of the library containing the Plugin class being built. Although they were exactly the same, code-wise; maybe the version could of been different or something, resulting in the most irritating "Cannot convert from Plugin to Plugin" (I forget the proper syntax). As a quick workaround I just popped the plugins libraries into the same directory as the exe, so they both reference the exact same Plugin library.
All your source are belong to us!
-
Let me make myself a bit more clear: I have 38 plugins already built, which implement this class. I worked a long time on them, and they are all working perfectly, so a complete redesign would make me have to strangle myself. Turns out the problem was that I had two copies of the library containing the Plugin class being built. Although they were exactly the same, code-wise; maybe the version could of been different or something, resulting in the most irritating "Cannot convert from Plugin to Plugin" (I forget the proper syntax). As a quick workaround I just popped the plugins libraries into the same directory as the exe, so they both reference the exact same Plugin library.
All your source are belong to us!
AndrewVos wrote:
Although they were exactly the same, code-wise; maybe the version could of been different or something, resulting in the most irritating "Cannot convert from Plugin to Plugin" (I forget the proper syntax).
I know this one. In daily work it helps a lot to remove all '*' from the version in the 'AssemblyInfo.cs'.
-
AndrewVos wrote:
Although they were exactly the same, code-wise; maybe the version could of been different or something, resulting in the most irritating "Cannot convert from Plugin to Plugin" (I forget the proper syntax).
I know this one. In daily work it helps a lot to remove all '*' from the version in the 'AssemblyInfo.cs'.