У меня есть плагины в виде файлов dll. Мое приложение загружает dll и работает нормально. но когда я пытаюсь удалить старый плагин и заменить его новым, это не позволяет мне сделать это. поскольку он был загружен приложением. Я обнаружил, что с помощью appdomain мы можем это сделать. но я не могу найти решение, в котором используется mef.
Мне нужен код, который может работать на mef. Ниже мой код, который используется для загрузки плагинов.
//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 plugins 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
var container = new CompositionContainer(aggregateCatalog);
// Composable parts are created here i.e. the Import and Export components assembles here
container.ComposeParts(this);