From 74e5487cbee781ac72ad60f54e79aba0cf1189b2 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Mon, 11 Nov 2019 09:40:46 -0800 Subject: [PATCH] forward to correct package name --- src/MSBuild.Abstractions/NugetHelpers.cs | 14 +++++++++++++- .../ProjectRootElementExtensions.cs | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/MSBuild.Abstractions/NugetHelpers.cs b/src/MSBuild.Abstractions/NugetHelpers.cs index 4078b8f6b..f9102b080 100644 --- a/src/MSBuild.Abstractions/NugetHelpers.cs +++ b/src/MSBuild.Abstractions/NugetHelpers.cs @@ -1,8 +1,10 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.IO; using System.Net.Http; using System.Text.Json; using System.Threading.Tasks; +using Microsoft.VisualBasic; namespace MSBuild.Abstractions { @@ -42,5 +44,15 @@ static string GetVersionFromQueryResponse(Stream result) return null; } } + + public static string FindPackageNameFromReferenceName(string referenceName) + { + if (StringComparer.OrdinalIgnoreCase.Compare(referenceName, "System.ComponentModel.DataAnnotations")==0) + { + return "System.ComponentModel.Annotations"; + } + + return referenceName; + } } } diff --git a/src/MSBuild.Conversion.Project/ProjectRootElementExtensions.cs b/src/MSBuild.Conversion.Project/ProjectRootElementExtensions.cs index 2f41d14a2..f71f0148b 100644 --- a/src/MSBuild.Conversion.Project/ProjectRootElementExtensions.cs +++ b/src/MSBuild.Conversion.Project/ProjectRootElementExtensions.cs @@ -155,7 +155,7 @@ public static IProjectRootElement RemoveOrUpdateItems(this IProjectRootElement p } else if (ProjectItemHelpers.IsReferenceConvertibleToPackageReference(item)) { - var packageName = item.Include; + string packageName = NugetHelpers.FindPackageNameFromReferenceName(item.Include); string version = null; try {