Search code examples
c#winformspluggable

How to create a pluggable GUI and DLLs in c#


Not sure the exact terms to use here, so any help would be appreciated.

To be the most simplistic, I have a forms application. When I load "form.exe", the form has one control, a menu. This menu has one menuitem, "Exit". What I would like, is when the Form is loading, be able to pass in arguments to this forms app that specify DLLs that could add specialized methods, controls, etc.

Now when I load "form.exe add_plugable.dll", my menu has another menuitem, "Add". When I load "form.exe add_plugable.dll remove_pluggable.dll", menu has 3 items "Exit", "Add", and "Remove".

Hope this makes sense. What do I need to include in the Forms application and how do I create my DLLs? I am aware I need a common interface, but dont know exactly how to accomplish this with namespaces and interfaces and abstract classes.

Thanks!


Solution

  • I would recommend looking into the Managed Extensibility Framework. It was designed for this exact type of scenario.

    For example, it is what Visual Studio uses for its extensibility, so add ins can be dynamically discovered and plugged in at runtime.