Fix dependency context bug and add load overload
This commit is contained in:
parent
880c141029
commit
029de95d0f
2 changed files with 11 additions and 2 deletions
|
@ -68,8 +68,12 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
|
||||
var libraryAssets = runtime ? export.RuntimeAssemblies : export.CompilationAssemblies;
|
||||
|
||||
foreach (var libraryDependency in export.Library.Dependencies)
|
||||
foreach (var libraryDependenciesGroup in export.Library.Dependencies.GroupBy(d => d.Name))
|
||||
{
|
||||
LibraryRange libraryDependency = libraryDependenciesGroup
|
||||
.OrderByDescending(d => d.Target == LibraryType.ReferenceAssembly)
|
||||
.First();
|
||||
|
||||
Dependency dependency;
|
||||
if (dependencyLookup.TryGetValue(libraryDependency.Name, out dependency))
|
||||
{
|
||||
|
|
|
@ -38,7 +38,12 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
private static DependencyContext LoadDefault()
|
||||
{
|
||||
var entryAssembly = Assembly.GetEntryAssembly();
|
||||
var stream = entryAssembly?.GetManifestResourceStream(entryAssembly.GetName().Name + DepsResourceSufix);
|
||||
return Load(entryAssembly);
|
||||
}
|
||||
|
||||
public static DependencyContext Load(Assembly assembly)
|
||||
{
|
||||
var stream = assembly.GetManifestResourceStream(assembly.GetName().Name + DepsResourceSufix);
|
||||
|
||||
if (stream == null)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue