Esempio n. 1
0
        private static IEnumerable <ManagedLibrary> ResolveRuntimeAssemblies(this DependencyContext depContext, RuntimeFallbacks runtimeGraph)
        {
            var rids = GetRids(runtimeGraph);

            return(from library in depContext.RuntimeLibraries
                   from assetPath in SelectAssets(rids, library.RuntimeAssemblyGroups)
                   select ManagedLibrary.CreateFromPackage(library.Name, library.Version, assetPath));
        }
Esempio n. 2
0
 public static void AddCompileDependencies(this AssemblyLoadContextBuilder builder, DependencyContext dependencyContext)
 {
     foreach (var library in dependencyContext.CompileLibraries.Where(cl => !dependencyContext.RuntimeLibraries.Any(rl => cl.Name.Equals(rl.Name))))
     {
         foreach (var libraryAssembly in library.Assemblies.Where(a => a.StartsWith("lib", StringComparison.OrdinalIgnoreCase)))
         {
             var managedLibrary = ManagedLibrary.CreateFromPackage(library.Name, library.Version, libraryAssembly);
             try
             {
                 builder.AddManagedLibrary(managedLibrary);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.Message);
             }
         }
     }
 }
Esempio n. 3
0
        private Assembly ManagedLoadContext_Resolving(AssemblyLoadContext loadContext, AssemblyName assemblyName)
        {
            this.SearchForLibrary(ManagedLibrary.CreateFromPackage(assemblyName.Name, assemblyName.Version.ToString(), assemblyName.Name + ".dll"), out var path);

            return(this.LoadFromAssemblyPath(path));
        }