diff --git a/src/chocolatey/infrastructure.app/nuget/NugetList.cs b/src/chocolatey/infrastructure.app/nuget/NugetList.cs index 0111f65015..6048a023fa 100644 --- a/src/chocolatey/infrastructure.app/nuget/NugetList.cs +++ b/src/chocolatey/infrastructure.app/nuget/NugetList.cs @@ -248,7 +248,7 @@ private async static Task> SearchPackagesAsyn } else { - var exactPackage = FindPackage(searchTermLower, configuration, nugetLogger, cacheContext, packageRepositoryResources, version); + var exactPackage = FindPackage(searchTermLower, configuration, nugetLogger, (SourceCacheContext)cacheContext, packageRepositoryResources, version); if (exactPackage == null) { @@ -342,6 +342,28 @@ public static ISet FindAllPackageVersions(string package return metadataList; } + /// + /// Searches for packages that are available based on name and other options + /// + /// Name of package to search for + /// Chocolatey configuration used to help supply the search parameters + /// The nuget logger + /// The resources that should be queried + /// Version to search for + /// Settings for caching of results from sources + /// One result or nothing + [Obsolete("Use the overload that uses the base source cache context instead.")] + public static IPackageSearchMetadata FindPackage( + string packageName, + ChocolateyConfiguration config, + ILogger nugetLogger, + ChocolateySourceCacheContext cacheContext, + IEnumerable resources, + NuGetVersion version) + { + return FindPackage(packageName, config, nugetLogger, (SourceCacheContext)cacheContext, resources, version); + } + /// /// Searches for packages that are available based on name and other options /// diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index e91910412c..f742d93dc2 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -628,7 +628,7 @@ public virtual ConcurrentDictionary Install(ChocolateyCon latestPackageVersion = version; } - var availablePackage = NugetList.FindPackage(packageName, config, _nugetLogger, sourceCacheContext, remoteEndpoints, latestPackageVersion); + var availablePackage = NugetList.FindPackage(packageName, config, _nugetLogger, (SourceCacheContext)sourceCacheContext, remoteEndpoints, latestPackageVersion); if (availablePackage == null) { @@ -1149,7 +1149,7 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon // this is a prerelease - opt in for newer prereleases. config.Prerelease = true; } - var availablePackage = NugetList.FindPackage(packageName, config, _nugetLogger, sourceCacheContext, remoteEndpoints, version); + var availablePackage = NugetList.FindPackage(packageName, config, _nugetLogger, (SourceCacheContext)sourceCacheContext, remoteEndpoints, version); config.Prerelease = originalPrerelease; @@ -1334,7 +1334,7 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon { if (version != null) { - var requestedPackageDependency = NugetList.FindPackage(parentPackage.Id, config, _nugetLogger, sourceCacheContext, remoteEndpoints, version); + var requestedPackageDependency = NugetList.FindPackage(parentPackage.Id, config, _nugetLogger, (SourceCacheContext)sourceCacheContext, remoteEndpoints, version); if (requestedPackageDependency != null) {