How to make a pluggable application

  • Thread starter Thread starter James Culshaw
  • Start date Start date
J

James Culshaw

Hi,

I am looking for some resources I could look at on how to make an
application that will accept plug-ins. I want to allow my application to be
enhanced overtime via the use of optional plug-ins that users can download
and install. Where should I look?

Thanks,

James :-)
 
Hi,

I don't know any resources about this, but I did such a thing using
reflection (so you should read up on that).

Simply put:
I created an 'Interface Library', which contains e.g. an IPlugIn interface,
that has all the methods and properties you would require to be able to
control your plugins, and with which the plugin could identify itself.
The 'host' application should reference the Interface Library and all the
'plugin' assemblies should as well... so using reflection, the host
application could scan a certain directory at startup (in which you should
place all your plugin assemblies), look at all the assemblies in that
directory, and seek out the ones that reference that Interface Library. Then
in those assemblies, look for the class that implements IPlugIn and create
an instance of that, add it to your 'pluginsCollection' or whatnot to keep a
reference, and that's basically it...

Hope that gives you an idea to start looking..

Regards,
Dick Appel
Icorp.nl
 
I am looking for some resources I could look at on how to make an
application that will accept plug-ins. I want to allow my application to be
enhanced overtime via the use of optional plug-ins that users can download
and install. Where should I look?
See the latest MSDN Magazine (Oct 2003)
There is a full article ("Plug-Ins: Let Users Add Functionality to Your .NET
Applications with Macros and Plug-Ins")
Code is available at http://msdn.microsoft.com/msdnmag/code03.aspx

Mihai
 
Here is an article from MSDN Magazine entitled "Let Users Add Functionality
to Your .NET Applications with Macros and Plug-Ins"
http://msdn.microsoft.com/msdnmag/issues/03/10/Plug-Ins/default.aspx

Here is another one that describes AppDomains and Assemblies, prerequisites
for understanding plug-ins.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp03122002.asp

And then a simple tutorial entitled: Building Snap-In Applications
http://www.codeproject.com/csharp/SnapIn.asp

Finally, some plug-in troubleshooting from Jon Skeet.
http://www.yoda.arachsys.com/csharp/plugin.html
 
James,

I've been looking into extendable applications as well. Basically, you
need to familiarize yourself with the concept of assemblies and the
reflection namespace.

One pointer: you cannot unload an assembly once it's been loaded. If
you want your application to be able to load a plugin and then later
unload it, you will have to contend with another thing called
"Application Domain" or AppDomain. Then you'll run into issues
regarding MarshalByRefObject, multi-threading etc., etc., etc. Refer
to another post titled "Issues Regarding AppDomain Usage" in
microsoft.public.dotnet.framework.clr for more info.

The references quoted by the other replies are absolutely must-reads.

If you need any specific help, please post.
 
Back
Top