I found that using appdomain we can do this. but I can not find a solution that uses mef.
Unfortunately, this is not supported by MEF. MEF was designed specifically for application extensibility, and not as a general-purpose paid system that supports offloading and code replacement at runtime.
The only way to make this work is to use MEF in a separate AppDomain and unload the entire AppDomain. The CLR itself does not support unloading a loaded assembly, except for unloading the entire AppDomain in which the assembly opens.
source share