diff --git a/CHANGELOG.md b/CHANGELOG.md index 16ce0c57..1e561420 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added - Ninject for .NET Core can now load extensions automatically -- The executing assembly's directory is considered as one of the base directories ## [3.3.1] - 2017-10-05 diff --git a/src/Ninject/Modules/ModuleLoader.cs b/src/Ninject/Modules/ModuleLoader.cs index 00e184a6..5f65376e 100644 --- a/src/Ninject/Modules/ModuleLoader.cs +++ b/src/Ninject/Modules/ModuleLoader.cs @@ -12,7 +12,6 @@ namespace Ninject.Modules using System.Collections.Generic; using System.IO; using System.Linq; - using System.Reflection; using Ninject.Components; using Ninject.Infrastructure; @@ -21,8 +20,6 @@ namespace Ninject.Modules /// public class ModuleLoader : NinjectComponent, IModuleLoader { - private static readonly string CurrentAssemblyDirectory = Path.GetDirectoryName(new Uri(typeof(ModuleLoader).Assembly.CodeBase).LocalPath); - /// /// Initializes a new instance of the class. /// @@ -56,8 +53,15 @@ public void LoadModules(IEnumerable patterns) var extension = fileGroup.Key; var plugin = plugins.Where(p => p.SupportedExtensions.Contains(extension)).FirstOrDefault(); + Console.WriteLine(fileGroup.Key); + if (plugin != null) { + foreach (var f in fileGroup) + { + Console.WriteLine(f); + } + plugin.LoadModules(fileGroup); } } @@ -79,14 +83,13 @@ private static IEnumerable NormalizePaths(string path) private static IEnumerable GetBaseDirectories() { - var baseDirectory = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); + var baseDirectory = AppDomain.CurrentDomain.BaseDirectory; var searchPath = AppDomain.CurrentDomain.RelativeSearchPath; - return (string.IsNullOrEmpty(searchPath) + return string.IsNullOrEmpty(searchPath) ? new[] { baseDirectory } : searchPath.Split(new[] { Path.PathSeparator }, StringSplitOptions.RemoveEmptyEntries) - .Select(path => Path.Combine(baseDirectory, path))) - .Concat(new[] { CurrentAssemblyDirectory }).Distinct(); + .Select(path => Path.Combine(baseDirectory, path)); } } } \ No newline at end of file