public virtual void AddAssemblyPaths(IEnumerable <string> assemblyPaths) { foreach (var assemblyPath in assemblyPaths) { var info = new AssemblyInfo { Path = assemblyPath }; var name = _assemblyUtility.GetAssemblyName(assemblyPath); info.Version = name.Version; AssemblyInfo foundInfo = null; var found = _assemblyInfoMap.TryGetValue(name.Name, out foundInfo); if (!found || foundInfo.Version.CompareTo(info.Version) < 0) { //if the assembly being passed is a higher version and an assembly with it's name has already been resolved if (found && foundInfo.Assembly != null) { _logger.WarnFormat("Conflict: Assembly {0} with version {1} cannot be added as it has already been resolved", assemblyPath, info.Version); continue; } _logger.DebugFormat("Mapping Assembly {0} to version:{1}", name.Name, name.Version); _assemblyInfoMap[name.Name] = info; } } }
private AggregateCatalog CreateAggregateCatalog(IEnumerable <string> paths) { var catalog = new AggregateCatalog(); foreach (var path in paths) { _logger.DebugFormat("Found assembly: {0}", path); try { if (_assemblyUtility.IsManagedAssembly(path)) { _logger.DebugFormat("Adding Assembly: {0} to catalog", path); var name = _assemblyUtility.GetAssemblyName(path); var assembly = _assemblyUtility.Load(name); _addToCatalog(assembly, catalog); } else { _logger.DebugFormat("Skipping Adding Native Assembly {0} to catalog", path); } } catch (Exception exception) { _logger.DebugFormat("Module Loader exception: {0}", exception.Message); } } return(catalog); }
private AggregateCatalog CreateAggregateCatalog(List <string> paths) { var catalog = new AggregateCatalog(); foreach (var path in paths) { _logger.DebugFormat("Found assembly: {0}", path); try { var name = _assemblyUtility.GetAssemblyName(path); var assembly = _assemblyUtility.Load(name); _addToCatalog(assembly, catalog); } catch (Exception exception) { _logger.DebugFormat("Module Loader exception: {0}", exception.Message); } } return(catalog); }