https://weblogs.asp.net/ricardoperes/using-mef-in-net-core
可以用https://www.bbsmax.com/A/xl56bpv45r/ 里面 AssemblyLoadContext.Default.LoadFromAssemblyPath
设置动态加载程序集的时候 发现 appdomain 获取目录 是空,还不能动态加载对应程序集;
翻译之后的意思是:
netcore 之后不支持了。
这里的关键是assemblyloadcontext类:它允许我们从文件流或字节数组获取程序集。
注意,在.NET Core中,情况发生了重大变化,现在我们没有appdomain或assembly.loadFrom,
程序集现在由程序集加载器加载,这与Java对类加载器的加载方式类似。
现在可以扩展动态程序集的目录。
var path = @"c:somepath"; var configuration = new ContainerConfiguration() .WithAssembliesInPath(path, conventions);