I have a MEF application (Microsoft Extension Framework) that loads some assemblies from a folder. I need to list the assemblies that produced any export for my application.
One way to do this is to list the import calling GetExportedObject().GetType().Assembly. But it would be easier to do this without creating an import. Is there a way to get downloaded assemblies from a directory or something else?
GetExportedObject().GetType().Assembly
I need assemblies to get their attributes, such as copyright, version, name, etc. My folder can contain both assemblies with and without export, but I only need assemblies that satisfy any imports in the application.
AssemblyCatalog Assembly. AggregateCatalog - , . DirectoryCatalog , , .
? , , AssemblyCatalog AggregateCatalog.
EDIT: MEF , "" . , , , , , GetExportedObject. API ReflectionModelServices, , . : , , .
Caliburn.Micro:
var aggregateCatalog = new AggregateCatalog(...); var assemblies = aggregateCatalog.Parts .Select(part => ReflectionModelServices.GetPartType(part).Value.Assembly) .Distinct() .ToList();
, :
, . IModule . bootstraper:
[ImportMany] public List<IModule> Modules { get; set; }
var module1 = Logic.Instance.Modules[0]; var fullename = module1.GetType().Assembly.FullName;