Updating dll file in MEF,

Feb 29, 2012 at 6:40 AM

I have an application which loads plugin from a directory. I call plugin functions and it is working fine. Now i want to do that is when application is running i update a plugin dll. But when i try to delete it it says that is being used by the application. I am not able to delete is so that i can place updated dll file there.

How this can be done. Below is my code. Please do appropriate changes in my code.

[ImportMany(AllowRecomposition=true)]
public System.Lazy<ICalculatorIDictionary<stringobject>>[] CalciPlugins { getset; }
 
//Creating an instance of aggregate catalog. It aggregates other catalogs
var aggregateCatalog = new AggregateCatalog();
                
//Build the directory path where the parts will be available
var directoryPath = "Path to the dll folder";
 
//Load parts from the available dlls in the specified path using the directory catalog
var directoryCatalog = new DirectoryCatalog(directoryPath, "*.dll");
 
//Add to the aggregate catalog
aggregateCatalog.Catalogs.Add(directoryCatalog);
 
//Crete the composition container
container = new CompositionContainer(aggregateCatalog);
                
// Composable parts are created here i.e. the Import and Export components assembles here
container.ComposeParts(this);
Mar 1, 2012 at 1:19 PM

i solved that issue with the information i found here:

http://shazwazza.com/post/Developing-a-plugin-framework-in-ASPNET-with-medium-trust.aspx

read also the comments at the end...