diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index a872b06515..e0dd2c9456 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -862,8 +862,19 @@ public ConcurrentDictionary get_outdated(ChocolateyConfig foreach (var packageName in packageNames) { - // LastOrDefault to get the latest package from local repository, because all packages have set IsLatestVersion to true - var latestPackage = packageManager.SourceRepository.GetPackages().Where(x => x.Id.ToLower() == packageName && x.IsLatestVersion).LastOrDefault(); + // If using local repository as source all packages have set IsLatestVersion to true. + var latestPackages = packageManager.SourceRepository.GetPackages().Where(x => x.Id.ToLower() == packageName && x.IsLatestVersion).ToList(); + + IPackage latestPackage = null; + + if(latestPackages.Count > 1) + { + latestPackage = latestPackages.Last(); + } + else + { + latestPackage = latestPackages.FirstOrDefault(); + } if(latestPackage == null) {