You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IReadOnlyCollection<LibraryRange>LibraryIdentities;// Use the provided nuget package source, or use nuget.orgvarsourceRepository=new SourceRepository(nugetSource??new PackageSource(DefaultNuGetSource), Providers);varpackages=await Task.WhenAll(LibraryIdentities.Select(x => GetBestMatch(x, sourceRepository, token))).ConfigureAwait(false);/// <summary>/// Gets the best matching PackageIdentity for the specified LibraryRange./// </summary>/// <param name="identity">The library range to find the best patch for.</param>/// <param name="sourceRepository">The source repository where to match.</param>/// <param name="token">A optional cancellation token.</param>/// <returns>The best matching PackageIdentity to the specified version range.</returns>publicstaticasyncTask<PackageIdentity>GetBestMatch(LibraryRangeidentity,SourceRepositorysourceRepository,CancellationTokentoken){varfindPackageResource=await sourceRepository.GetResourceAsync<FindPackageByIdResource>(token).ConfigureAwait(false);varversions=await findPackageResource.GetAllVersionsAsync(identity.Name, _sourceCacheContext, _logger, token).ConfigureAwait(false);varbestPackageVersion= versions?.FindBestMatch(identity.VersionRange,version => version);returnnew PackageIdentity(identity.Name, bestPackageVersion);}
At the moment you are just using the "Min Version" which is not always correct.
The text was updated successfully, but these errors were encountered:
glennawatson
changed the title
Add support for NuGet LibraryRange
Add support for NuGet LibraryRange or VersionRange
Jun 14, 2019
Hey there,
On ReactiveUI.Pharamacist we use the same version matching as the NuGet team use.
So they have a built in method called "GetBestMatch" and they grab the version information from the NuGet server.
https://github.com/reactiveui/Pharmacist/blob/master/src/Pharmacist.Core/NuGet/NuGetPackageHelper.cs
At the moment you are just using the "Min Version" which is not always correct.
The text was updated successfully, but these errors were encountered: