var catalog = new AggregateCatalog();catalog.Catalogs.Add(new DirectoryCatalog("."));var container = new CompositionContainer(catalog);
var catalog = new AggregateCatalog();catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));catalog.Catalogs.Add(new DirectoryCatalog("."));var container = new CompositionContainer(catalog);
public void Assemblecalculatorcomponents () {String path = Path.Combine (appdomain.currentdoma In. BaseDirectory, "Plugins"); Console.WriteLine (path); Check the directory exists if (! Directory.Exists (Path)) {directory.createdirectory (path); } Console.WriteLine (path); String assemblyname = assembly.getentryassembly (). FullName; Console.WriteLine (AssemblyName); Create an assembly catalog of the assemblies with exports var catalog = new Aggregatecatalog ( New Assemblycatalog (assembly.getexecutingassembly (). Location), New Assemblycatalog (Assembly.Load (AssemblyName)), new Directorycatalog (Path, "*.d ll ")); Create a composition container var container = new Compositioncontainer (catalog); Container.composeparts (this);
MEF load plugin from directory