Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to load dlls from directory using MEF (Managed Extensibility Framework)
    text
    copied!<p>i am currently working with MEF and facing some problems</p> <p>what i want is to load dlls from the directory.</p> <p>first i scan the directory and save two things in dictionary</p> <p>Name property from respective DLL (as string)</p> <p>and Module Name (as string)</p> <p>here is ScanDirectory() code</p> <pre><code>private void ScanPluginDirectory() { catalog = new AggregateCatalog(); catalog.Catalogs.Add(new DirectoryCatalog(@"..\..\plugin")); container = new CompositionContainer(catalog); batch = new CompositionBatch(); batch.AddPart(this); container.Compose(batch); pluginDictionary = new Dictionary&lt;String, String&gt;(); foreach (IFilter filter in filters) { Type t = filter.GetType(); pluginDictionary.Add(filter.Name, t.Module.Name); } } </code></pre> <p>and show their name in a checkbox list. upon selection of dll from checkbox.</p> <p>i have import statement as</p> <pre><code>[Import] public IEnumerable&lt;IFilter&gt; filters { get; set; } </code></pre> <p>currently my program is running fine. what i did is when i check a plugin from checkbox list. it moves it into "loaded" directory and and they QueryPlugin() method looks into "loaded" directory to search for plugins.</p> <p>upon unchecking plugin from checkbox list. i move it out of "loaded" directory...</p> <p>What i want is to use batch.RemovePart() method to get rid of this rapid moving of dlls from one directory to other....</p> <p>NOTE: i am not adding plugins manually into batch using </p> <pre><code>batch.AddPart(new DemoFilter1()); </code></pre> <p>instead of this i used DirectoryCatalog();;</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload