问题
I'm looking for a plugin-based application framework that is comparable to the Eclipse Plugin Framework, which to my simple mind consists of:
- a core plugin management framework (Equinox / OSGI), which provides the ability to declare extension endpoints and then discover and load plugins that service those endpoints. (this is different than Dependency Injection, but admittedly the difference is subtle - configuration is highly de-centralized, there are versioning concerns, it might involve an online plugin repository, and most importantly to me, it should be easy for the user to add plugins without needing to know anything about the underlying architecture / config files)
- many layers of plugins that provide a basic workbench shell with concurrency support, commands, preference sheets, menus, toolbars, key bindings, etc.
That is just scratching the surface of the RCP, which itself is meant to serve as the foundation of your application, which you build by writing / assembling even more plugins.
Here's what I've gleaned from the internet in the past couple of days...
As far as I can tell, there is nothing in the .NET world that remotely approaches the robustness and maturity of the Eclipse RCP for Java but there are several contenders that do either #1 or #2 pretty well.
(I should also mention that I have not made a final decision on WinForms vs WPF, so I'm also trying to understand the level of UI coupling in any candidate framework. I'm also wondering about platform coupling and source code licensing)
I must say that the open-source stuff is generally less-documented but easier to understand, while the MS stuff typically has more documentation but is less accessible, so that with many of the MS technologies, I'm left wondering what they actually do, in a practical sense.
These are the libraries I have found:
SharpDevelop
The first thing I looked at was SharpDevelop, which does both #1 and also #2 in a basic way (no insult to SharpDevelop, which is admirable - I just mean more basic than Eclipse RCP). However, SharpDevelop is an application more than a framework, and there are basic assumptions and limitations there (i.e. being somewhat coupled to WinForms). Still, there are some articles on CodeProject explaining how to use it as the foundation for an application.
System.Addins
It appears that System.Addins is meant to provide a robust add-in loading framework, with some sophisticated options for loading assemblies with varying levels of trusts and even running the out of process. It appears to be primarily code-based, and pretty code-heavy, with lots of assemblies that serve to insulate against versioning issues., using Guidance Automation to generate a good deal of code.
So far I haven't found many System.AddIns articles that illustrate how it could be used to build something like an Eclipse RCP, and many people seem to be wringing their hands about its complexity.
Mono.Addins
It appears that Mono.Addins was influenced by System.Addins, SharpDevelop, and MonoDevelop. It seems to provide the basics from System.Addins, with less sophisticated options for plugin loading, but more simplicity, with attribute-based registration, XML manifests, and the infrastructure for online plugin repositories.
It has a pretty good FAQ and documentation, as well as a fairly robust set of examples that really help paint a picture of how to develop an architecture like that of SharpDevelop or Eclipse. The examples use GTK for UI, but the framework itself is not coupled to GTK. So it appears to do #1 (add-in loading) pretty well and points the way to #2 (workbench framework). It appears that Mono.Addins was derived from MonoDevelop, but I haven't actually looked at whether MonoDevelop provides a good core workbench framework.
Managed Extensibility Framework
This is what everyone's talking about at the moment, and it's slowly getting clearer what it does, but I'm still pretty fuzzy, even after reading several posts on SO. The official word is that it "can live side-by-side" with System.Addins. However, it doesn't reference it and it appears to reproduce some of its functionality. It seems to me, then, that it is a simpler, more accessible alternative to System.Addins.
It appears to be more like Mono.Addins in that it provides attribute-based wiring. It provides "catalogs" that can be attribute-based or directory-based. It does not seem to provide any XML or manifest-based wiring. So far I haven't found much documentation and the examples seem to be kind of "magical" and more reminiscent of attribute-based DI, despite the clarifications that MEF is not a DI container.
Its license just got opened up, but it does reference WindowsBase -- not sure if that means it's coupled to Windows.
Acropolis
I'm not sure what this is. Is it MEF, or something that is still coming?
Composite Application Blocks
There are WPF and Winforms Composite Application blocks that seem to provide much more of a workbench framework. I have very little experience with these but they appear to rely on Guidance Automation quite a bit are obviously coupled with the UI layers. There are a few examples of combining MEF with these application blocks.
I've done the best I could to answer my own question here, but I'm really only scratching the surface, and I don't have experience with any of these frameworks. Hopefully some of you can add more detail about the frameworks you have experience with. It would be great if we could end up with some sort of comparison matrix.
回答1:
Can be considered...
Composite Application Guidance for WPF and Silverlight
Visual Studio 2008 Shell
回答2:
You should really take a look at the Visual Studio Shell. It is available in both an integrated mode, where you application resides along side visual studio as an addin or you can use the shell in isolated mode where the shell just serves as a basic framework for your application alone similar to the Eclipse shell. Check out this webpage.
The Visual Studio shell is robust, feature rich and free. I have not done any development in it yet, but I have been looking at it for an upcoming project. It looks to be every bit as powerful of a plugin framework as Eclipse.
回答3:
+1 for SharpDevelop. The libraries are well-written and simple to extend. I'm actually writing my own code refactoring application using the SharpDevelop Core and their Addin infrastructure.
Very nice.
-Doug
回答4:
While I'm not familiar with the specifics of RCP, I think DxCore is probably going to be the most complete framework for extending Visual Studio with managed code. It uses a plug-in based architecture and gives you the ability to create anything from tool windows (hosting whatever code you want) to "Actions" (items which can be tied to keyboard shortcuts and context menus) and refactorings, with an extremely rich context system, and a language agnostic code generation engine. It provides a very nice abstraction layer on top of the rather scary underbelly of Visual Studio. It is also written to be version agnostic, so plugins written against DxCore will work for VS 2005 and VS 2008.
While it is free it is not open source, and there is, sadly, very little documentation. You have the samples provided, which are a good start, but here are some other resources that could be useful:
- Mark Miller is the Architect for DxCore/CodeRush/Refactor Pro!, and has some postings on his blog (and DNR TV episodes) about writing DxCore plugins.
- There is a community forum where you can post questions. This is followed by Mark and some of the other DxCore developers, as well as some folks from the community
- DxCore Plugins on Google Code. An attempt to collect the plugins that have been created by the community into one place. This is a nice mixture of tools and refactorings, though some are out of date.
Hopefully this will be useful to you. The only thing really bad I have to say about it, and the reason it is probably not more widely utilized is that it is such a large library, with almost no documentation, you have to be willing to dig to find out how to utilize some of the cooler features.
Good Luck!
回答5:
I just released SoapBox Core as open source and wrote an introductory article on CodeProject. It's basically what you're looking for. It uses MEF for extensibility, and I got a lot of the ideas from SharpDevelop. Note that it's brand new and still evolving rapidly.
来源:https://stackoverflow.com/questions/232345/what-add-in-workbench-framework-is-the-best-net-alternative-to-eclipse-rcp