public static IEnumerable <string> GetDependenciesInternal(Assembly source) { AppDomainSetup setup = new AppDomainSetup(); setup.ApplicationBase = Path.GetDirectoryName(source.Location); AppDomain dependencyDomain = AppDomain.CreateDomain("DependencyLister", null, setup); DependencyLister.Lister lister = (DependencyLister.Lister)dependencyDomain.CreateInstanceFromAndUnwrap(typeof(Microsoft.Research.Naiad.Cluster.DependencyLister.Lister).Assembly.Location, "Microsoft.Research.Naiad.Cluster.DependencyLister.Lister"); List <string> ret = lister.ListDependencies(source.Location).ToList(); AppDomain.Unload(dependencyDomain); return(ret); }
/// <summary> /// Returns the locations of non-framework assemblies on which the assembly with the given filename depends. /// </summary> /// <param name="assemblyFilename">The filename of the assembly</param> /// <returns>An array of filenames for non-framework assemblies on which the given assembly depends</returns> public string[] ListDependencies(string assemblyFilename) { Assembly assembly = Assembly.LoadFrom(assemblyFilename); return(Lister.Dependencies(assembly).Select(x => x.Location).ToArray()); }