static Assembly LoadAssemblyFromRunDir(object sender, ResolveEventArgs e) { try { var name = new AssemblyName(e.Name); if (!ourAssemblies.Contains(name.Name)) { return(null); } var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var filename = Path.Combine(path, name.Name + ".dll"); if (!File.Exists(filename)) { return(null); } return(Assembly.LoadFrom(filename)); } catch (Exception ex) { var log = string.Format(CultureInfo.CurrentCulture, "Error occurred loading {0} from {1}.{2}{3}{4}", e.Name, Assembly.GetExecutingAssembly().Location, Environment.NewLine, ex, Environment.NewLine); VsOutputLogger.Write(log); } return(null); }
Assembly LoadAssemblyFromExtensionDir(object sender, ResolveEventArgs e) { try { var name = new AssemblyName(e.Name).Name; var filename = Path.Combine(extensionDir, name + ".dll"); if (!File.Exists(filename)) { return(null); } var targetName = AssemblyName.GetAssemblyName(filename); // Resolve any exact `FullName` matches. if (e.Name != targetName.FullName) { // Resolve any version of our assemblies. if (!ourAssemblies.Contains(name, StringComparer.OrdinalIgnoreCase)) { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Not resolving '{0}' to '{1}'.", e.Name, targetName.FullName)); return(null); } Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Resolving '{0}' to '{1}'.", e.Name, targetName.FullName)); } Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Loading '{0}' from '{1}'.", targetName.FullName, filename)); return(Assembly.LoadFrom(filename)); } catch (Exception ex) { var log = string.Format(CultureInfo.CurrentCulture, "Error occurred loading {0} from {1}.{2}{3}{4}", e.Name, Assembly.GetExecutingAssembly().Location, Environment.NewLine, ex, Environment.NewLine); Trace.WriteLine(log); VsOutputLogger.Write(log); } return(null); }
public override void Write(string message) { VsOutputLogger.Write(message); }