public AsyncRewriterTask() { var assemblyPath = this.GetType().Assembly.Location; var components = Path.GetDirectoryName(assemblyPath) .Split(Path.DirectorySeparatorChar) .Reverse() .SkipWhile(c => !c.Equals("packages", StringComparison.InvariantCultureIgnoreCase)) .Reverse() .ToList(); var path = string.Join(Path.DirectorySeparatorChar.ToString(), components); if (path != "") { var pathsByFileName = new Dictionary<string, string>(); foreach (var value in GetDlls(path)) { var fileName = Path.GetFileName(value); if (fileName != null) { pathsByFileName[fileName] = value; } } AppDomain.CurrentDomain.AssemblyResolve += (sender, e) => { var fileName = e.Name.Split(',')[0] + ".dll"; if (pathsByFileName.TryGetValue(fileName, out path)) { if (File.Exists(path)) { return Assembly.LoadFrom(path); } } return null; }; } this.rewriter = new Rewriter(); }
public AsyncRewriterTask() { this.rewriter = new Rewriter(); }