/// <summary> /// Loads the assembly. /// </summary> /// <param name="file">The file.</param> /// <returns>Assembly.</returns> protected Assembly LoadAssembly(string file) { try { return(Assembly.Load(File.ReadAllBytes((file)))); } catch (Exception ex) { FailedAssemblies.Add(file); Logger.ErrorException("Error loading assembly {0}", ex, file); return(null); } }
/// <summary> /// Loads the assembly. /// </summary> /// <param name="file">The file.</param> /// <returns>Assembly.</returns> protected Assembly LoadAssembly(string file) { try { #if NET46 return(Assembly.Load(File.ReadAllBytes(file))); #elif NETSTANDARD1_6 return(AssemblyLoadContext.Default.LoadFromStream(new MemoryStream(File.ReadAllBytes(file)))); #endif return(null); } catch (Exception ex) { FailedAssemblies.Add(file); Logger.ErrorException("Error loading assembly {0}", ex, file); return(null); } }