Re: Thanks... but...

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Laurent,

You should still do what I recommended.

What you need to do is create an interface that the main form will
implement which exposes the functionality. Then, you pass that interface
definition to your plug in. Of course, the interface is defined in the
assembly that is referenced by the plug in and the main application.

Either that, or pass the type System.Windows.Forms.Form to your plug in,
instead of the typed version.

It's actually a really bad idea to allow plug ins free reign like this.
You should have a constrained set of functionality that the form implements
and exposes through the interface definition and then pass that to your plug
in.

--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx

"Laurent Navarro" <yop@xxxxxxx> wrote in message
news:unikUn8uGHA.1216@xxxxxxxxxxxxxxxxxxxxxxx
Thanks Nicholas and Andy for your quick answer, I understand that I
must create an assembly that both the plugins and the applications will
reference when compiling.

I already created an abstract PlugIn class which is the base class for
all of my plugin (it is not only an interface as I have some functions in
it). Because I want my plugin to interact directly with the GUI of my
applications, I have a reference to my main form in the PlugIn class.

Of course, when I try to compile my abstract PlugIn class into an
assembly, it doesn't want because he can't find the reference to my main
form.

I'm begining in assemblies, what should I do ?

Thanks !









"Laurent Navarro" <yop@xxxxxxx> a écrit dans le message de news:
O91u6z7uGHA.4624@xxxxxxxxxxxxxxxxxxxxxxx
Hello,


I created a software some times ago, which uses some plugins to work
(which I coded also). I had problems to load those plugins as they used
some classes and functions which were compiled into the main executable.
So I had to compile them by hand, adding the main executable as reference
to the csc.exe command line. It worked.

Now, I would like to create another application which would use the
same plugin. If I link the old ones with my new software, I have an error
saying that the DLL could not be loaded. I use the
Activator.GetInstance() function...

My question is: is there a way to share my plugins between my
applications without having to compile them each time with a difference
reference to the main executable ?


Thank you for your help !

Laurent





.



Relevant Pages

  • Re: C# Plugin system - same interface in two different assemblies...
    ... "add a reference to the appropriate assemblies to each and every project"? ... You don't have each plugin project deciding what ... its idea of the interface is. ... can't by forcing people to include them in assemblies as I've explained. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to use interfaces properly...
    ... > MyInterfaceTest). ... > property on the reference to "false". ... > interface have to have its own copy of the dll that contains the ... > references that will work during development, but will also let the plugin ...
    (microsoft.public.dotnet.framework)
  • How to use interfaces properly...
    ... project and added a reference to that assembly (it's named MyInterfaceTest). ... interface have to have its own copy of the dll that contains the interface? ... references that will work during development, but will also let the plugin ...
    (microsoft.public.dotnet.framework)
  • Re: Return collection interfaces or collection objects???
    ... I like returning an interface better than ... and you are exposing operations on that reference (which IList does as well, ... dependancy - the caller will be returned an object reference and will ... caller would still have the minimum functionality that the called ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: [RFC] Changes to the driver model class code.
    ... >> So this means every device will have yet another reference count, ... class device attribute access paths. ... The interface may get simpler, ... the "functionality" of the device core to teach, encourage, and forcing to ...
    (Linux-Kernel)