Mvc icon indicating copy to clipboard operation
Mvc copied to clipboard

MEF - Microsoft.Composition nuget support

Open ankursoni opened this issue 11 years ago • 5 comments

Am trying to use Microsoft.Composition 1.0.3 in my web MVC project using latest DNX 5.0 beta 8. But it is not composing my simple plugin interfaces using the WithDefaultConventions for Type and Derived Types. The only time it worked is using the WithAssembly in a console app but cannot run in web app because of the inability to utilize System.Reflection.

Any pointers to help here are greatly appreciated.

ankursoni avatar Oct 30 '15 11:10 ankursoni

How are you plugging in MEF into the application? Do you have an adapter that works with DependencyInjection.Abstractions?

but cannot run in web app because of the inability to utilize System.Reflection. Your web app should be able to System.Reflection just fine.

pranavkm avatar Oct 30 '15 12:10 pranavkm

It is in similar lines to the sample given is https://mef.codeplex.com/wikipage?title=What%20is%20Microsoft.Composition%3f&referringTitle=Documentation Basically the plugin is based on Export attributes and no DI is used. Also, adding the reference to System.Reflection gives the following error: Error CS0117 'Assembly' does not contain a definition for 'GetExecutingAssembly' WebApplication.DNX Core 5.0

ankursoni avatar Oct 30 '15 13:10 ankursoni

MEF hasn't been ported to work on .NET Core, so running on .NET Core (dnxcore50) won't work. You should be able to use MEF on the full .NET Framework though.

danroth27 avatar Oct 30 '15 16:10 danroth27

Any updates on this? I am thinking of developing a .Net Core class library with MEF or any other alternative approaches so far?

Thanks in advance.

technicalganesh avatar May 24 '16 12:05 technicalganesh

Have you taken a look at. https://www.nuget.org/packages/Microsoft.Composition/

Petermarcu avatar May 24 '16 16:05 Petermarcu