Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Commit

Permalink
Fix for Casing problems Nugets (#831)
Browse files Browse the repository at this point in the history
* Fix for Casing problems Nugets

* More string comparing made case-insensitive
  • Loading branch information
StephanTuinder authored and MarcBruins committed Jun 28, 2019
1 parent ff21582 commit c270e4d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ public int CountCurrentVersions()

private void CheckIdConsistency()
{
if (CurrentPackages.Any(p => p.Id != SelectedId))
if (CurrentPackages.Any(p => !p.Id.Equals(SelectedId,StringComparison.InvariantCultureIgnoreCase)))
{
var errorIds = CurrentPackages
.Select(p => p.Id)
.Distinct()
.Where(id => id != SelectedId);
.Where(id => !id.Equals(SelectedId,StringComparison.InvariantCultureIgnoreCase));

throw new ArgumentException($"Updates must all be for package '{SelectedId}', got '{errorIds.JoinWithCommas()}'");
}
Expand Down
3 changes: 2 additions & 1 deletion NuKeeper.Inspection/NuGetApi/PackageUpdatesLookup.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
Expand Down Expand Up @@ -37,7 +38,7 @@ public PackageUpdatesLookup(IBulkPackageLookup bulkPackageLookup)
var matchVersion = latestPackage.Selected().Identity.Version;

var updatesForThisPackage = packages
.Where(p => p.Id == packageId && p.Version < matchVersion)
.Where(p => p.Id.Equals(packageId,StringComparison.InvariantCultureIgnoreCase) && p.Version < matchVersion)
.ToList();

if (updatesForThisPackage.Count > 0)
Expand Down
5 changes: 3 additions & 2 deletions NuKeeper.Update/Process/UpdateDirectoryBuildTargetsCommand.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
Expand Down Expand Up @@ -47,8 +48,8 @@ public UpdateDirectoryBuildTargetsCommand(INuKeeperLogger logger)

var packageNodeList = packagesNode.Elements("PackageReference")
.Where(x =>
(x.Attributes("Include").Any(a => a.Value == currentPackage.Id)
|| x.Attributes("Update").Any(a => a.Value == currentPackage.Id)));
(x.Attributes("Include").Any(a => a.Value.Equals(currentPackage.Id, StringComparison.InvariantCultureIgnoreCase))
|| x.Attributes("Update").Any(a => a.Value.Equals(currentPackage.Id,StringComparison.InvariantCultureIgnoreCase))));

foreach (var dependencyToUpdate in packageNodeList)
{
Expand Down

0 comments on commit c270e4d

Please sign in to comment.