开发者

C# plugin system design

开发者 https://www.devze.com 2023-01-21 02:37 出处:网络
So I am creating a plugin system for my app. I 开发者_StackOverflow社区have the following components:

So I am creating a plugin system for my app.

I 开发者_StackOverflow社区have the following components: 1) Main Application 2) PluginInterface.dll 3) Plugin(s).dll

The problem now is that, when I create my plugins and compile them, there are more then just the Plugin.dll file. It has other required files in the Release directory such as the PluginInterface.dll that it uses, an xml configuration file, etc.

So how can I make it so that it is just a single dll file that user can drop into a plugin directory?

OR

do you think it's better to have the plugins be a folder? then, i have to scan all the folders for the right DLL...


The Managed Extensibility Framework is designed for plugin architectures. Before you go too far down your current path, check it out. It might serve you better.


When you compile your plug-in project, right-click on the references to the DLLs you are seeing and select properties. In the proepties set the "Copy Local" property to "false". Make sure that these DLLs are part of your main application, otherwise the code will fail when it can't find code that depends on it.


If you want to do that when compiling your solution you should create a post build event (Project Properties -> Build Events) to copy only the required files to the plugin directory. You could also change the OutputPath of you project and use the option "Copy Local" to "false", but you'll not have the same level of control as by creating a build event.

0

精彩评论

暂无评论...
验证码 换一张
取 消