Hi,

Can anyone point me towards a working example of a plug-in architecture for C#/.Net 2?

I am developing a simple task manager and I want the individual task types to have their own, separately compiled processors. These will conform to a common interface / API defined by the task manager. I have used the System.Reflection classes and methods to create the processors dynamically and all is nearly working, but I cannot get the cast from created object to the interface type to work. I have also tried defining the interface as a class (as there is nothing else that needs to be inherited), but run into the same problem with the cast. I cannot call the API methods unless the cast is accepted by the CLR.

If someone can point me towards a working example, that would probably be the best way for me to find the trouble and I would be very grateful as this has been holding me up for a while.

Thanks in anticipation.

Define your common interface / API in a seperate dll and reference this in all processes.
This seperates all libraries from the interface library and allows the task manager to still strongly reference all classes.
Also, if you later update the task manager it will not break the processor dlls.

Nick,

Thank you for the advice. Unfortunately, I cannot get at the code until Tuesday, but I will let you know the result as soon as I can.

Thanks again.

Simon.

Nick,

That solved the problems - thanks again.

Simon.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.