using System.IO; using System.Reflection; namespace Abp.Reflection.Extensions { public static class AssemblyExtensions { /// /// Gets directory path of given assembly or returns null if can not find. /// /// The assembly. public static string GetDirectoryPathOrNull(this Assembly assembly) { var location = assembly.Location; if (location == null) { return null; } var directory = new FileInfo(location).Directory; if (directory == null) { return null; } return directory.FullName; } } }