.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Articles >> Architecture/Pattern >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Creating a Plugin enabled Application : Part 1 of 2

Posted By:Jean Paul       Posted Date: May 04, 2011    Points: 200    Category: Architecture/Pattern    URL: http://www.dotnetspark.com  

Making applications plugin enabled could give us lots of flexibility in the long run.

Creating a Plugin enabled Application : Part 1 of 2

In this article I am trying to show how to create a plugin enabled application using .Net Reflection.  The plugin enabled application loads an associated piece of software during the runtime.  There should not be any design time binding for the specified component.

Advantages of Plugins

We can see lots of plugin enabled applications for example Winamp.  The plugin enable application provides the following flexibilities:

-          Reduced Size in Initial Deployment

-          Incrementing the modules as plugins

-          Customers can be benefited by choosing Plugin Modules thus reduction in Cost

How Plugins works?

There will be 3 components in a plugin architecture application.

1)      Plugin Container

2)      Plugin Interface

3)      Plugins

The Plugin Container will serve as the host holding all plugins found in runtime.

The Plugin Interface provides as a standard of communication between the Container and Plugins.

The Plugins are the actual piece of software which are located and loaded by the Plugin Container.


The plugin enabled application executes as depicted in the image below.  After the application is executed, it will search for the plugins of associated interfaces.  If any plugins found they are instantiated and loaded into the application.

Diving into the Code

I hope we had enough of theories.  Now let us focus on how to build the actual code.  In our example, we are trying to load plugins which contains forms.  There is one Plugin.Core application which will perform as the Plugin Container and n number of plugin dll's which contains the forms.

Each form found will be having a display name so that we can show it in the toolbar.

Component 1: Plugin Container .exe

This is a Windows Forms Application containing the Main Form to contain the plugins. 

Component 2: Plugin. Interface.dll

This would be a Class Library containing the IPlugin interface.

public interface IPlugin


    string Text { get; }

    Form Form { get; }

    Color BackColor { get; }


There will be a PluginLoader class which basically takes care of finding the plugins in given folder and loading them into the system.

Component 3: BlueForm.Plugin.dll

This will be a Class Library project containing the plugins.  The plugins are nothing other than classes which implements the IPlugin interface.

In our project, we are creating a plugin class named BlueFormPlugin which holds  a form.


For the time being I have used Windows Forms for plugin example, but we can extend the same idea to ASP.NET, WPF, Windows Mobile applications too.


In this article the basic components of building a the Plugin based application is explained.  In the next part we can see the inner details of how the plugin can be identified and loaded into the application using Reflection.

 Subscribe to Articles


Further Readings:

Author: Mahesh         Company URL: http://www.dotnetspark.com
Posted Date: May 04, 2011

Hi its a nice application

Author: Jean Paul         Company URL: http://www.dotnetspark.com
Posted Date: May 04, 2011

Thank You Mahesh for the goo words..

I will put the second part soon with explanations.

Jean Paul

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend