private IEnumerable <PackageCarrier> LoadModule(PackageLoadingContext loadingContext) { var libFolder = new DirectoryInfo(loadingContext.LibraryDirectory); var files = LibraryLocator.GetFilesToLoad(libFolder, loadingContext); return(files.Select(x => new PackageCarrier(Assembly.LoadFile(x.FullName), loadingContext))); }
public static IEnumerable <FileInfo> GetFilesToLoad(DirectoryInfo libFolder, PackageLoadingContext context) { var dlls = libFolder.GetFiles("*.dll"); if (!dlls.Any()) { if (libFolder.GetFiles().SingleOrDefault()?.Name == "_._") { return(Enumerable.Empty <FileInfo>()); //implemented in GAC } throw new InvalidOperationException($"Cannot load package {context.Package} ({context.PackageDirectory}) because there are no dlls"); } return(dlls); }
public PackageCarrier(Assembly assembly, PackageLoadingContext context) { Assembly = assembly; Context = context; }