The Managed Extensibility Framework (MEF) and Managed AddIn Framework (MAF, aka System.AddIn) seem to accomplish very similar tasks. According to this Stack Overflow questio
In my opinion, the best way to discover the differences is some hands-on code. I found two MSDN walkthroughs, both with a calculator example so you can easily compare their implementations:
MEF: Simple calculator example using MEF parts
(Managed Extensibility Framework)
catalog.Catalogs.Add(new DirectoryCatalog("Plugins", "*.dll"));
instead of using catalog.Catalogs.Add(new
AssemblyCatalog(typeof(Program).Assembly));
and extract the
calculator code and contract to separate DLL projects.)MEF does not need to have a specific directory structure, it is simple and straightforward to use, even for small projects. It works with attributes, to declare what is exported, which is easy to read and understand. Example:
[Export(typeof(IOperation))]
[ExportMetadata("Symbol", '+')]
class Add: IOperation
{
public int Operate(int left, int right)
{
return left + right;
}
}
MEF does not automatically deal with versioning
MAF: Simple calculator with V1 and V2 version MAF plugins
(Managed Addin Framework)
Pipeline AddIns CalcV1 CalcV2 AddInSideAdapters AddInViews Contracts HostSideAdapters
Both MEF and MAF are included in the .NET Framework 4.x. If you compare the two examples you will notice that the MAF plugins have a lot more complexity compared with the MEF framework - so you need to think carefully when to use which of those frameworks.