@@ -123,17 +123,30 @@ static IEnumerable<PackageInfo> ResolveDependenciesFor(IEnumerable<PackageInfo>
123
123
var result = new List < PackageInfo > ( ) ;
124
124
var map = new Dictionary < string , List < PackageInfo > > ( ) ;
125
125
126
- foreach ( var p in packages )
127
- foreach ( var nupkg in Directory . GetFiles ( p . SpecFile . GetDirName ( ) . GetDirName ( ) , "*.nupkg" , SearchOption . AllDirectories ) )
126
+ void add ( PackageInfo info )
127
+ {
128
+ if ( ! map . ContainsKey ( info . Name ) )
129
+ map [ info . Name ] = new List < PackageInfo > ( ) ;
130
+ map [ info . Name ] . Add ( info ) ;
131
+ }
132
+
133
+ foreach ( var parentPackage in packages )
134
+ {
135
+ add ( parentPackage ) ;
136
+
137
+ foreach ( var nupkg in Directory . GetFiles ( parentPackage . SpecFile . GetDirName ( ) . GetDirName ( ) , "*.nupkg" , SearchOption . AllDirectories ) )
128
138
{
129
139
var info = ExtractPackageInfo ( nupkg ) ;
130
- info . PreferredRuntime = p . PreferredRuntime ;
131
140
132
- if ( ! map . ContainsKey ( info . Name ) )
133
- map [ info . Name ] = new List < PackageInfo > ( ) ;
141
+ // if user requested a specific version, then do not interfere and ignore other packages with the same
142
+ // name but potentially different version
143
+ if ( info . Name == parentPackage . Name && parentPackage . Version . HasText ( ) )
144
+ continue ;
134
145
135
- map [ info . Name ] . Add ( info ) ;
146
+ info . PreferredRuntime = parentPackage . PreferredRuntime ;
147
+ add ( info ) ;
136
148
}
149
+ }
137
150
138
151
foreach ( var key in map . Keys )
139
152
{
@@ -344,7 +357,9 @@ static public string[] Resolve(string[] packages, bool suppressDownloading, stri
344
357
newPackageWasInstalled = true ;
345
358
sw . Stop ( ) ;
346
359
}
347
- catch { }
360
+ catch ( Exception e )
361
+ {
362
+ }
348
363
349
364
try
350
365
{
0 commit comments