/* * Return the list of assemblies that a compilation needs to reference for a given * config minus the top-level assemblies indexed later than removeIndex */ internal static ICollection GetReferencedAssemblies(CompilationSection compConfig, int removeIndex) { AssemblySet referencedAssemblies = new AssemblySet(); // Add all the config assemblies to the list foreach (AssemblyInfo a in compConfig.Assemblies) { Assembly[] assemblies = a.AssemblyInternal; if (assemblies == null) { lock (compConfig) { assemblies = a.AssemblyInternal; if (assemblies == null) // assemblies = a.AssemblyInternal = compConfig.LoadAssembly(a); } } for (int i = 0; i < assemblies.Length; i++) { if (assemblies[i] != null) { referencedAssemblies.Add(assemblies[i]); } } } // Clone the top level referenced assemblies (code + global.asax + etc...), up to the removeIndex for (int i = 0; i < removeIndex; i++) { referencedAssemblies.Add(TheBuildManager.TopLevelReferencedAssemblies[i]); } // foreach (Assembly assembly in s_dynamicallyAddedReferencedAssembly) { referencedAssemblies.Add(assembly); } return referencedAssemblies; }
/* * Return an AssemblySet which contains all the assemblies that * are referenced by the input assembly */ internal static AssemblySet GetReferencedAssemblies(Assembly a) { AssemblySet referencedAssemblies = new AssemblySet(); AssemblyName[] refs = a.GetReferencedAssemblies(); foreach (AssemblyName aname in refs) { Assembly referencedAssembly = Assembly.Load(aname); // Ignore mscorlib if (referencedAssembly == typeof(string).Assembly) continue; referencedAssemblies.Add(referencedAssembly); } return referencedAssemblies; }
internal static AssemblySet GetReferencedAssemblies(Assembly a) { AssemblySet set = new AssemblySet(); foreach (AssemblyName name in a.GetReferencedAssemblies()) { Assembly o = Assembly.Load(name); if (!(o == typeof(string).Assembly)) { set.Add(o); } } return set; }