hello,
i have a weird problem. i would like to delete an assembly(plugin.dll on harddisk) which is already loaded, but the assembly is locked by the operating system (vista), even if i have unloaded it.
f.e.
AppDomainSetup setup = new AppDomainSetup();
setup.ShadowCopyFiles = "true";
AppDomain appDomain = AppDomain.CreateDomain(assemblyName + "_AppDomain", AppDomain.CurrentDomain.Evidence, setup);
IPlugin plugin = (IPlugin)appDomain.CreateInstanceFromAndUnwrap(assemblyName, "Plugin.MyPlugins");
I also need the assemblyinfos, because I don't know which classes in the pluginassembly implements the IPlugin Interface. It should be possible to have more than one Plugin in one Pluginassembly.
Assembly assembly = appDomain.Load(assemblyName);
if (assembly != null) {
Type[] assemblyTypes = assembly.GetTypes();
foreach (Type assemblyTyp in assemblyTypes) {
if (typeof(IPlugin).IsAssignableFrom(assemblyTyp)) {
IPlugin plugin = (IPlugin)Activator.CreateInstance(assemblyTyp);
plugin.AssemblyName = assemblyNameWithEx;
plugin.Host = this;
}
}
}
AppDomain.Unload(appDomain);
How is it possible to get the assemblyinfos from the appDomain without locking the assembly?
best regards