Commit de898d8d by dingsongjie

优化 程序集查找

parent fb922525
Showing with 8 additions and 2 deletions
......@@ -10,10 +10,15 @@ namespace Pole.Core.Utils
{
public class AssemblyHelper
{
private static IList<Assembly> Assemblies;
public static IList<Assembly> GetAssemblies(ILogger logger = default)
{
var libs = DependencyContext.Default.CompileLibraries.Where(lib => !lib.Serviceable);
return libs.Select(lib =>
if (Assemblies != null)
{
return Assemblies;
}
var libs = DependencyContext.Default.CompileLibraries.Where(lib => !lib.Serviceable && !lib.Name.StartsWith("Microsoft") && !lib.Name.StartsWith("System"));
Assemblies = libs.Select(lib =>
{
try
{
......@@ -26,6 +31,7 @@ namespace Pole.Core.Utils
return default;
}
}).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