Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / February 2007

Tip: Looking for answers? Try searching our database.

Question about Assembly.CreateInstance()

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brad Figler - 09 Feb 2007 03:30 GMT
Here is my setup:

I want a plugin interface for my application.

I have my main app named App.exe
I have a plugin interface assembly named PluginInterface.dll (defines
IPluginInterface)
I have a plugin implementation named PluginTest.dll (defines TestClass)

In my application I simply do the following:

Assembly myAssembly = Assembly.LoadFile( "PluginTest.dll" );
IPluginInterface plugin = (IPluginInterface)myAssembly.CreateInstance(
"TestClass" );

plugin.Test() (one of the methods specified in the plugin interface).

I compile the code and I get the following:

MyApp.exe
PluginInterface.dll
PluginTest.dll

If I delete PluginInterface, My code won't run. Is there a way to
specify an interface w/o having to actually deploy a dll that just has
an interface specification in it?

Thanks,

Brad
Mike - 09 Feb 2007 04:23 GMT
> Here is my setup:
>
[quoted text clipped - 26 lines]
>
> Brad

I believe that you can specify IPluginInterface within the MyApp.exe
project.  Then, when you create your PluginTest.dll, you just have to
reference the MyApp project.  The only time you would need the shared
middle dll is if you define a second interface that MyApp implements
so your plugin has some idea about the application using it.

Mike
Brad Figler - 09 Feb 2007 04:55 GMT
>> Here is my setup:
>>
[quoted text clipped - 34 lines]
>
> Mike

Yeah, that is the "other" solution that I found during my time on google.

I don't necessarily want to do that because I have a bit of a funky
setup (from a development point of view).

The actual code that will use the plugin is a windows service. The
service entry point simply launches thread(s) that actually do the work
(and respond to the service manager requests). Well, the myApp.exe in
the above example is actually a test harness that includes all of the
code accept the entry point in to the service. This allows me to "run"
my services in normal program space while developing/debugging.

If I was to do that, I would have to put my plugin interface in my
service.exe and I don't want to do that because I want my test harness
to run independently of the service (and vice versa).

Long story short, I will just deal with the additional DLL.

Thanks for the response.

Brad

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.