using Microsoft.Extensions.DependencyModel; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Runtime.Loader; namespace EntrustSettle.Common.Extensions; public static class AssemblysExtensions { public static List GetAllAssemblies() { var list = new List(); var deps = DependencyContext.Default; var libs = deps.CompileLibraries.Where(lib => !lib.Serviceable && lib.Type != "package" ); foreach (var lib in libs) { var assembly = AssemblyLoadContext.Default.LoadFromAssemblyName(new AssemblyName(lib.Name)); list.Add(assembly); } return list; } }