Commit de898d8d by dingsongjie

优化 程序集查找

parent fb922525
Showing with 8 additions and 2 deletions
...@@ -10,10 +10,15 @@ namespace Pole.Core.Utils ...@@ -10,10 +10,15 @@ namespace Pole.Core.Utils
{ {
public class AssemblyHelper public class AssemblyHelper
{ {
private static IList<Assembly> Assemblies;
public static IList<Assembly> GetAssemblies(ILogger logger = default) public static IList<Assembly> GetAssemblies(ILogger logger = default)
{ {
var libs = DependencyContext.Default.CompileLibraries.Where(lib => !lib.Serviceable); if (Assemblies != null)
return libs.Select(lib => {
return Assemblies;
}
var libs = DependencyContext.Default.CompileLibraries.Where(lib => !lib.Serviceable && !lib.Name.StartsWith("Microsoft") && !lib.Name.StartsWith("System"));
Assemblies = libs.Select(lib =>
{ {
try try
{ {
...@@ -26,6 +31,7 @@ namespace Pole.Core.Utils ...@@ -26,6 +31,7 @@ namespace Pole.Core.Utils
return default; return default;
} }
}).Where(assembly => assembly != default).ToList(); }).Where(assembly => assembly != default).ToList();
return Assemblies;
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment