Following MEF Export will not be loaded by ComposeParts(this).
using MyLib;
using System.Composition;
namespace Test
{
[Export(typeof(IExtension))]
public class Test : IExtension
{
}
}
This happens when you auto-install MEF to dotnetcore using Visual Studio Alt+Enter menu. The correct namespace is System.ComponentModel.Composition. Due to quite similarly named namespace this may be overseen.
using MyLib;
using System.ComponentModel.Composition; // <--
namespace Test
{
[Export(typeof(IExtension))]
public class Test : IExtension
{
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.