/// <summary> /// Initializes a new instance of <see cref="DefaultAssemblyProvider"/> /// </summary> /// <param name="logger">Logger for logging</param> /// <param name="entryAssembly"><see cref="Assembly">Entry assembly</see> - if null, it will try to get entry assembly</param> public DefaultAssemblyProvider(ILogger logger, Assembly entryAssembly = null) { if (entryAssembly == null) { entryAssembly = Assembly.GetEntryAssembly(); } var dependencyModel = DependencyContext.Load(entryAssembly); logger.Trace($"Dependency model has {dependencyModel.RuntimeLibraries.Count()} libraries"); Libraries = dependencyModel.RuntimeLibraries.Cast <RuntimeLibrary>().Where(_ => _.RuntimeAssemblyGroups.Count() > 0).ToArray(); logger.Trace($"Dependency model has {Libraries.Count()} libraries belonging to an assembly group"); foreach (var library in Libraries) { logger.Trace($"Providing '{library.Name}, {library.Version}'"); } }