/// <summary> /// Makes sure matching assemblies in the supplied folder are loaded in the app domain. /// </summary> /// <param name="directoryPath"> /// The physical path to a directory containing dlls to load in the app domain. /// </param> protected virtual void LoadMatchingAssemblies(string directoryPath) { var loadedAssemblyNames = new List <string>(); foreach (var a in GetAssemblies()) { loadedAssemblyNames.Add(a.FullName); } if (!_fileProvider.DirectoryExists(directoryPath)) { return; } foreach (var dllPath in _fileProvider.GetFiles(directoryPath, "*.dll")) { try { var an = AssemblyName.GetAssemblyName(dllPath); if (an.FullName.Contains("Research.Data") || an.FullName.Contains("Research.Service") || an.FullName.Contains("Research.Web.Framework")) { App.Load(an); } //old loading stuff //Assembly a = Assembly.ReflectionOnlyLoadFrom(dllPath); //if (Matches(a.FullName) && !loadedAssemblyNames.Contains(a.FullName)) //{ // App.Load(a.FullName); //} } catch (BadImageFormatException ex) { Trace.TraceError(ex.ToString()); } } }