I need to unload my loaded assembly. I have used LoadFrom to give me the flexability of loading the dll from any location.
However, to totally remove the assembly I need to unload the AppDomain, but I don't know how to initialy load the assembly into the AppDomain.
AppDomain newDomain = AppDomain.CreateDomain("newDomain", null, domainSetup);
assembly a = Assembly.LoadFrom(filename);
foreach (Type TypeAlgorithm in a.GetExportedTypes())
{
if (TypeAlgorithm.IsClass == true)
{
ObjAlgorithmInstance = Activator.CreateInstance(TypeAlgorithm);
methodInfo = ObjAlgorithmInstance.GetType().GetMethod("start");
methodInfo.Invoke(ObjAlgorithmInstance, new object[] { });
}
}
//NEED TO UNLOAD THE ASSEMBLY, BUT HOW???