@@ -78,18 +78,25 @@ public DependencyResolver(string assemblyPath)
7878
7979 string ? SearchRuntimeAssets ( IEnumerable < RuntimeAssetGroup > runtimeAssets )
8080 {
81- if ( ! runtimeAssets . Any ( ) )
81+ var runtimeAssetGroups = runtimeAssets . ToList ( ) ;
82+
83+ if ( runtimeAssetGroups . Count == 0 )
8284 {
8385 return null ;
8486 }
8587
8688 foreach ( var runtime in runtimes )
8789 {
88- foreach ( var asset in runtimeAssets )
90+ foreach ( var asset in runtimeAssetGroups )
8991 {
90- if ( asset . Runtime ? . Equals ( runtime , StringComparison . Ordinal ) ?? false )
92+ if ( ! ( asset . Runtime ? . Equals ( runtime , StringComparison . Ordinal ) ?? false ) )
9193 {
92- var assetPath = asset . AssetPaths [ 0 ] ;
94+ continue ;
95+ }
96+
97+ foreach ( var candidateAssetPath in asset . AssetPaths )
98+ {
99+ var assetPath = candidateAssetPath ;
93100
94101 // If we're in the default runtime section of the deps.json file, we just need the file name and not the full path
95102 if ( asset . Runtime ? . Equals ( string . Empty , StringComparison . Ordinal ) ?? false )
@@ -101,12 +108,10 @@ public DependencyResolver(string assemblyPath)
101108 // from the NuGet package cache folder.
102109 assetPath = Path . GetFullPath ( Path . Combine ( assemblyDirectory , assetPath ) ) ;
103110
104- if ( ! File . Exists ( assetPath ) )
111+ if ( File . Exists ( assetPath ) )
105112 {
106- assetPath = null ;
113+ return assetPath ;
107114 }
108-
109- return assetPath ;
110115 }
111116 }
112117 }
@@ -144,4 +149,4 @@ public DependencyResolver(string assemblyPath)
144149
145150 return null ;
146151 }
147- }
152+ }
0 commit comments