I'm trying to delete assembly after loading, but cannot. Please help me. Thanks.
private Assembly AssemblyResolve(object sender, ResolveEventArgs args)
{
try
{
AssemblyName assemblyName = new AssemblyName(args.Name);
string folderBeyConsPath = FindInstallBeyConsFolderPath(FolderBeyConsPathKey);
if (string.IsNullOrEmpty(folderBeyConsPath) || !Directory.Exists(folderBeyConsPath)) return null;
string file = Directory.GetFiles(folderBeyConsPath, "*.dll").Where(x => Path.GetFileNameWithoutExtension(x) == assemblyName.Name).FirstOrDefault();
if (!string.IsNullOrEmpty(file))
{
byte[] content = File.ReadAllBytes(file);
return Assembly.Load(content);
}
}
catch { }
return null;
}