MEF (Managed Extensibility Framework) is a general .NET programming approach for extending programs such as Visual Studio. VS packages / extensions can use the new VS-MEF classes (contracts) instead of MPF classes. MEF is recognized by classes decorated with [Export]
attributes. Typically, you inherit a specific class as a color element and export it to Visual Studio, which then looks at all the exports in your MEF package and imports them.
The MPF (Managed Package Framework) is similar to the class system around the old COM shells of the non-managed / native VS extension model. You programmatically extend Visual Studio by receiving services and implementing MPF class methods (MPF classes, in turn, implement COM-like interfaces. COM-swooning VS. For example, LanguageService
implements IVsLanguageInfo
and some other interfaces, but it just โcollectsโ the interface methods, which can then be overridden in the implementation class of LanguageService
).
If you want to implement a complete programming language, you combine MPF and MEF. You use MEF for parts of the editor, such as tokenization (which is required for syntax highlighting), highlighting, shape matching, etc. And MPF for other VS objects, such as new tool windows, property pages, etc.
Instead of MPF, you can also use old COM wrappers, but the MPF classes already do some COM work for you, which you will have to deal with if you choose COM wrappers.
You can also implement a tokenizer, etc. with MPF, but I tried it and found it much more unintuitive than MEF. If you ask me, it is much more complicated and will require more Braindamage than MEF, but I still have to go through with MEF, as I got with MPF.
This confuses me a bit because MSDN mixes MEF and MPF articles, as I noticed. You should carefully monitor which subdivision of MSDN you go to, you can easily switch from the MEF category to MPF by accident. However, MSDN hints at the fact that there are some general articles on the VS extension, for example here: http://msdn.microsoft.com/en-us/library/cc138569.aspx