Skip to content

Commit

Permalink
Added additional check for version while resolving through packages l…
Browse files Browse the repository at this point in the history
…ock file (#2583)
  • Loading branch information
jainaashish committed Jan 9, 2019
1 parent 9b828ef commit 70f8756
Show file tree
Hide file tree
Showing 4 changed files with 207 additions and 51 deletions.
12 changes: 8 additions & 4 deletions src/NuGet.Core/NuGet.DependencyResolver.Core/ResolverUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,17 +211,21 @@ public static async Task<RemoteMatch> FindLibraryMatchAsync(
// check for the exact library through local repositories
var localMatch = await FindLibraryByVersionAsync(library, framework, localProviders, cacheContext, logger, cancellationToken);

if (localMatch != null)
if (localMatch != null
&& localMatch.Library.Version.Equals(library.Version))
{
return localMatch;
}

// if not found in local repositories, then check the remote repositories
var remoteMatch = await FindLibraryByVersionAsync(library, framework, remoteProviders, cacheContext, logger, cancellationToken);

// either found or not, we must return from here since we dont want to resolve to any other version
// then defined in packages.lock.json file
return remoteMatch;
if (remoteMatch != null
&& remoteMatch.Library.Version.Equals(library.Version))
{
// Only return the result if the version is same as defined in packages.lock.json file
return remoteMatch;
}
}

// it should never come to this, but as a fail-safe if it ever fails to resolve a package from lock file when
Expand Down
Loading

0 comments on commit 70f8756

Please sign in to comment.