public static IDynamicAppCompiler AddCoreReference(this IDynamicAppCompiler compiler) { if (compiler == null) { throw new ArgumentNullException(nameof(compiler)); } string coreLocation = typeof(object).GetTypeInfo().Assembly.Location; return(compiler.AddReference(coreLocation)); }
/// <summary> /// Adds the current references. /// </summary> /// <param name="compiler">The compiler.</param> public static IDynamicAppCompiler AddCurrentReferences(this IDynamicAppCompiler compiler) { if (compiler == null) { throw new ArgumentNullException(nameof(compiler)); } RuntimeContext.Current.GetPlatformRuntimeAssemblies() .Foreach(e => { if (File.Exists(e.Location) && !e.Location.EndsWith("ni.dll")) { compiler.AddReference(e.Location); } }); return(compiler); }
public static IDynamicAppCompiler AddCurrentReferences(this IDynamicAppCompiler compiler) { if (compiler == null) { throw new ArgumentNullException(nameof(compiler)); } PlatformServices.Default.LibraryManager.GetLibraries() .SelectMany(e => e.Assemblies) .Distinct() .Select(e => Assembly.Load(e)) .Foreach(e => { if (File.Exists(e.Location) && !e.Location.EndsWith("ni.dll")) { compiler.AddReference(e.Location); } }); return(compiler); }