Hello
I have a main app that is going to have some plugins in the ./plugin directory.
Every plugin is a .NET dll and should have the namespace “Plugin” and a class “MainClass” implementing the IPlugin interface defined in the main app.
The problem I have is that I don’t know how I could share the same interface across the main app and every plugin without a using reference?
A part of the main app class:
object oo = Assembly.LoadFile(path).CreateInstance("Plugin.MainClass");
IPlugin pp = (IPlugin)oo; //Fails if I define the interface in the main app and the plugins
and a part of the first plugin:
namespace Plugin
{
public class MainClass : IPlugin //I cannot reference the interface in the main app?
{
public string getName()
{
return "Plugin 1";
}
}
}
You are correct in that to use an interface (or class, struct etc…) you must reference that assembly. If you do not wish to have your plugins reference the main application (which makes sense) Why not add a new assembly for this purpose? Calling it ‘framework’ or ‘util’.
E.G