public IEvaluator ReferenceDomainAssemblies(DomainAssemblies assemblies = DomainAssemblies.AllStaticNonGAC) #endif { //NOTE: It is important to avoid loading the runtime itself (mscorelib) as it //will break the code evaluation (compilation). // //On .NET mscorelib is filtered out by GlobalAssemblyCache check but //on Mono it passes through so there is a need to do a specific check for mscorelib assembly. var relevantAssemblies = AppDomain.CurrentDomain.GetAssemblies(); if (assemblies == DomainAssemblies.AllStatic) { relevantAssemblies = relevantAssemblies.Where(x => !CSSUtils.IsDynamic(x) && x != mscorelib).ToArray(); } else if (assemblies == DomainAssemblies.AllStaticNonGAC) { relevantAssemblies = relevantAssemblies.Where(x => !x.GlobalAssemblyCache && !CSSUtils.IsDynamic(x) && x != mscorelib).ToArray(); } else if (assemblies == DomainAssemblies.None) { relevantAssemblies = new Assembly[0]; } foreach (var asm in relevantAssemblies) { ReferenceAssembly(asm); } return(this); }
/// <summary> /// References the assemblies the are already loaded into the current <c>AppDomain</c>. /// </summary> /// <param name="assemblies">The type of assemblies to be referenced.</param> /// <returns>The instance of the <see cref="CSScriptLibrary.IEvaluator"/> to allow fluent interface.</returns> #if net35 public IEvaluator ReferenceDomainAssemblies(DomainAssemblies assemblies)