AssemblyHelper.cs 616 B

12345678910111213141516171819202122
  1. using System.Collections.Generic;
  2. using System.IO;
  3. using System.Linq;
  4. using System.Reflection;
  5. using System.Runtime.Loader;
  6. namespace Abp.Reflection
  7. {
  8. internal static class AssemblyHelper
  9. {
  10. public static List<Assembly> GetAllAssembliesInFolder(string folderPath, SearchOption searchOption)
  11. {
  12. var assemblyFiles = Directory
  13. .EnumerateFiles(folderPath, "*.*", searchOption)
  14. .Where(s => s.EndsWith(".dll") || s.EndsWith(".exe"));
  15. return assemblyFiles.Select(
  16. Assembly.LoadFile
  17. ).ToList();
  18. }
  19. }
  20. }