From f5fe242871f3c1a0b097a5c8a70c0bb6e3d0592f Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 12 Sep 2018 16:05:43 -0700 Subject: [PATCH 01/14] Add string for PackageReferenceVersionNotRecommended --- src/Tasks/Common/Resources/Strings.resx | 5 ++++- src/Tasks/Common/Resources/xlf/Strings.cs.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.de.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.es.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.fr.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.it.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.ja.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.ko.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.pl.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.ru.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.tr.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf | 5 +++++ 14 files changed, 69 insertions(+), 1 deletion(-) diff --git a/src/Tasks/Common/Resources/Strings.resx b/src/Tasks/Common/Resources/Strings.resx index 5c224b778060..780be934c921 100644 --- a/src/Tasks/Common/Resources/Strings.resx +++ b/src/Tasks/Common/Resources/Strings.resx @@ -401,4 +401,7 @@ The following are names of parameters or literal values and should not be transl NETSDK1070: The application configuration file must have root configuration element. {StrBegin="NETSDK1070: "} - + + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + + \ No newline at end of file diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index caa3c1892517..9fcbb4b03aab 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -67,6 +67,11 @@ NETSDK1008: Chybí metadata {0} o {1} položky {2}. {StrBegin="NETSDK1008: "} + + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + + NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'. NETSDK1009: Nerozpoznaný token preprocesoru {0} v {1}. diff --git a/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/Tasks/Common/Resources/xlf/Strings.de.xlf index 27cf73b474d7..9f1d2c98bef7 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -67,6 +67,11 @@ NETSDK1008: Die Metadaten "{0}" für das Element "{2}" vom Typ "{1}" sind nicht vorhanden. {StrBegin="NETSDK1008: "} + + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + + NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'. NETSDK1009: Unbekanntes Präprozessortoken "{0}" in "{1}". diff --git a/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/Tasks/Common/Resources/xlf/Strings.es.xlf index 93f1f3acafc4..bbf74f031892 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -67,6 +67,11 @@ NETSDK1008: Faltan los metadatos de "{0}" en el elemento de "{1}" "{2}". {StrBegin="NETSDK1008: "} + + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + + NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'. NETSDK1009: Token de preprocesador no reconocido "{0}" en "{1}". diff --git a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf index a209ffc3c170..3de69b9fb9ef 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -67,6 +67,11 @@ NETSDK1008: Métadonnées '{0}' manquantes sur l'élément '{1}' '{2}'. {StrBegin="NETSDK1008: "} + + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + + NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'. NETSDK1009: Jeton de préprocesseur '{0}' non reconnu dans '{1}'. diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/Tasks/Common/Resources/xlf/Strings.it.xlf index c5326b87bd1f..756318f95e89 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -67,6 +67,11 @@ NETSDK1008: mancano i metadati di '{0}' sull'elemento '{2}' di '{1}'. {StrBegin="NETSDK1008: "} + + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + + NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'. NETSDK1009: token di preprocessore '{0}' non riconosciuto in '{1}'. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf index 803f87f04baf..bcd063d955e2 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -67,6 +67,11 @@ NETSDK1008: '{1}' 項目 '{2}' の '{0}' メタデータがありません。 {StrBegin="NETSDK1008: "} + + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + + NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'. NETSDK1009: 認識されないプリプロセッサ トークン '{0}' が '{1}' に存在します。 diff --git a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf index 1a077a4df692..4bd049d808d1 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -67,6 +67,11 @@ NETSDK1008: '{1}' 항목 '{2}'에 '{0}' 메타데이터가 없습니다. {StrBegin="NETSDK1008: "} + + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + + NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'. NETSDK1009: '{1}'에서 전처리기 토큰 '{0}'을(를) 인식할 수 없습니다. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf index c62da27f1892..fe44886093f5 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -67,6 +67,11 @@ NETSDK1008: Brak metadanych „{0}” w elemencie „{1}” „{2}”. {StrBegin="NETSDK1008: "} + + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + + NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'. NETSDK1009: Nierozpoznany token preprocesora „{0}” w elemencie „{1}”. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf index 8e4fbdc4ce16..81317289abc0 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -67,6 +67,11 @@ NETSDK1008: Metadados '{0}' ausentes no item '{1}' '{2}'. {StrBegin="NETSDK1008: "} + + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + + NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'. NETSDK1009: Token de pré-processador não reconhecido '{0}' em '{1}'. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf index 4527cffc23b6..bf871d2a21df 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -67,6 +67,11 @@ NETSDK1008: отсутствуют метаданные "{0}" для элемента "{2}" в "{1}". {StrBegin="NETSDK1008: "} + + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + + NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'. NETSDK1009: не распознан маркер препроцессора "{0}" в "{1}". diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf index 1d90b1f8dbde..7eb3edd73d1a 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -67,6 +67,11 @@ NETSDK1008: '{1}' öğesi '{2}' üzerinde '{0}' meta verileri eksik. {StrBegin="NETSDK1008: "} + + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + + NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'. NETSDK1009: '{1}' içinde tanınmayan '{0}' ön işlemci belirteci. diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf index 8a6cdb6454bc..a6359e9eb023 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -67,6 +67,11 @@ NETSDK1008: 在“{1}”项“{2}”上缺少“{0}”元数据。 {StrBegin="NETSDK1008: "} + + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + + NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'. NETSDK1009:“{1}”中无法识别预处理器标记“{0}”。 diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf index 27b81bd4139f..abf2651cca49 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -67,6 +67,11 @@ NETSDK1008: '{1}' 項目 '{2}' 上遺漏 '{0}' 中繼資料。 {StrBegin="NETSDK1008: "} + + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + + NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'. NETSDK1009: '{1}' 中的前置處理器語彙基元 '{0}' 無法辨識。 From 458422804a14be151322d944adc3e6980c2d9f63 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Thu, 13 Sep 2018 14:21:08 -0700 Subject: [PATCH 02/14] Update stage 0 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 3f0f8d1b3a14..b95eb5a9ebe7 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "2.2.100-preview1-009263" + "version": "2.2.100-preview2-009404" }, "msbuild-sdks": { "RoslynTools.RepoToolset": "1.0.0-beta2-62912-01" From 72ddf54fcbe6dbe0106731baa2d8103c0d70d9ee Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Thu, 13 Sep 2018 15:27:59 -0700 Subject: [PATCH 03/14] Add support in .NET SDK for implicit versions of AspNetCore.App and .All --- .../ApplyImplicitVersions.cs | 78 +++++++++++++++++++ .../Microsoft.NET.Sdk.DefaultItems.targets | 37 +++++++++ 2 files changed, 115 insertions(+) create mode 100644 src/Tasks/Microsoft.NET.Build.Tasks/ApplyImplicitVersions.cs diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ApplyImplicitVersions.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ApplyImplicitVersions.cs new file mode 100644 index 000000000000..bdfb6a429204 --- /dev/null +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ApplyImplicitVersions.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Build.Framework; + +namespace Microsoft.NET.Build.Tasks +{ + + // TODO: Provide way to opt out of warning when Version is specified (possibly with the DisableImplicitFrameworkReferences property) + public class ApplyImplicitVersions : TaskBase + { + public string TargetFrameworkVersion { get; set; } + + public bool TargetLatestRuntimePatch { get; set; } + + public ITaskItem[] PackageReferences { get; set; } = Array.Empty(); + + public ITaskItem[] ImplicitPackageReferenceVersions { get; set; } = Array.Empty(); + + [Output] + public ITaskItem[] PackageReferencesToUpdate { get; set; } + + protected override void ExecuteCore() + { + var packageReferencesToUpdate = new List(); + + var implicitReferencesForThisFramework = ImplicitPackageReferenceVersions + .Select(item => new ImplicitPackageReferenceVersion(item)) + .Where(item => item.TargetFrameworkVersion == this.TargetFrameworkVersion) + .ToDictionary(implicitVersion => implicitVersion.Name); + + foreach (var packageReference in PackageReferences) + { + ImplicitPackageReferenceVersion implicitVersion; + if (implicitReferencesForThisFramework.TryGetValue(packageReference.ItemSpec, out implicitVersion)) + { + string versionOnPackageReference = packageReference.GetMetadata(MetadataKeys.Version); + if (string.IsNullOrEmpty(versionOnPackageReference)) + { + + packageReference.SetMetadata(MetadataKeys.Version, + TargetLatestRuntimePatch ? implicitVersion.LatestVersion : implicitVersion.DefaultVersion); + + packageReferencesToUpdate.Add(packageReference); + + } + else + { + // NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + Log.LogWarning(Strings.PackageReferenceVersionNotRecommended, packageReference.ItemSpec, versionOnPackageReference); + } + } + } + + PackageReferencesToUpdate = packageReferencesToUpdate.ToArray(); + } + + class ImplicitPackageReferenceVersion + { + ITaskItem _item; + public ImplicitPackageReferenceVersion(ITaskItem item) + { + _item = item; + } + // The name / Package ID + public string Name => _item.ItemSpec; + + // The target framework version that this item applies to + public string TargetFrameworkVersion => _item.GetMetadata("TargetFrameworkVersion"); + + public string DefaultVersion => _item.GetMetadata("DefaultVersion"); + + public string LatestVersion => _item.GetMetadata("LatestVersion"); + + } + } +} diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets index a89fca2790ef..17d54b314ad6 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets @@ -155,6 +155,43 @@ Copyright (c) .NET Foundation. All rights reserved. true + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets index 801d9eadfa1d..bd80eec9020e 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets @@ -158,23 +158,28 @@ Copyright (c) .NET Foundation. All rights reserved. - - - - - + + + + + + + + + + + + + + + true + true + + + + true + true + From db369bfb0d616736e7195ea88b9ad8282329af24 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Tue, 18 Sep 2018 19:12:43 -0700 Subject: [PATCH 08/14] Update stage 0 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index b95eb5a9ebe7..e1ed7103bbe3 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "2.2.100-preview2-009404" + "version": "2.2.100-preview3-009413" }, "msbuild-sdks": { "RoslynTools.RepoToolset": "1.0.0-beta2-62912-01" From 830f74b670fac7a042d987c227884f76d7f2fc7d Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Tue, 18 Sep 2018 19:15:50 -0700 Subject: [PATCH 09/14] Disable Web SDK implicit logic, enable using RuntimeFrameworkVersion --- src/Tasks/Common/MetadataKeys.cs | 4 +- .../ApplyImplicitVersions.cs | 2 +- .../ResolvePackageAssets.cs | 8 +- .../Microsoft.NET.Sdk.DefaultItems.props | 3 + .../Microsoft.NET.Sdk.DefaultItems.targets | 92 +++---------------- ...rosoft.PackageDependencyResolution.targets | 6 ++ .../GivenThatWeWantToBuildANetCoreApp.cs | 3 +- .../GivenThereAreDefaultItems.cs | 5 +- 8 files changed, 35 insertions(+), 88 deletions(-) diff --git a/src/Tasks/Common/MetadataKeys.cs b/src/Tasks/Common/MetadataKeys.cs index 03f63bcde64d..32b05ceb492e 100644 --- a/src/Tasks/Common/MetadataKeys.cs +++ b/src/Tasks/Common/MetadataKeys.cs @@ -16,6 +16,7 @@ internal static class MetadataKeys public const string PackageVersion = "PackageVersion"; public const string IsImplicitlyDefined = "IsImplicitlyDefined"; public const string IsTopLevelDependency = "IsTopLevelDependency"; + public const string AllowExplicitVersion = "AllowExplicitVersion"; // Target Metadata public const string RuntimeIdentifier = "RuntimeIdentifier"; @@ -81,8 +82,5 @@ internal static class MetadataKeys // Resource assemblies public const string Culture = "Culture"; public const string DestinationSubDirectory = "DestinationSubDirectory"; - - // Expected platform packages - public const string ExpectedVersion = "ExpectedVersion"; } } diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ApplyImplicitVersions.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ApplyImplicitVersions.cs index f7a0e155b706..41bd442ada89 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/ApplyImplicitVersions.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ApplyImplicitVersions.cs @@ -54,7 +54,7 @@ protected override void ExecuteCore() packageReferencesToUpdate.Add(packageReference); } - else + else if (!(packageReference.GetBooleanMetadata(MetadataKeys.AllowExplicitVersion) ?? false)) { // NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs buildWarnings.Add(string.Format(Strings.PackageReferenceVersionNotRecommended, packageReference.ItemSpec, versionOnPackageReference)); diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs index a737753cf7c2..956637da0ed7 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs @@ -341,7 +341,7 @@ internal byte[] HashSettings() foreach (var implicitPackage in ExpectedPlatformPackages) { writer.Write(implicitPackage.ItemSpec ?? ""); - writer.Write(implicitPackage.GetMetadata(MetadataKeys.ExpectedVersion) ?? ""); + writer.Write(implicitPackage.GetMetadata(MetadataKeys.Version) ?? ""); } } writer.Write(ProjectAssetsCacheFile); @@ -849,10 +849,10 @@ bool hasTwoPeriods(string s) if (_task.VerifyMatchingImplicitPackageVersion && _task.ExpectedPlatformPackages != null) { - foreach (var implicitPackge in _task.ExpectedPlatformPackages) + foreach (var implicitPackage in _task.ExpectedPlatformPackages) { - var packageName = implicitPackge.ItemSpec; - var expectedVersion = implicitPackge.GetMetadata(MetadataKeys.ExpectedVersion); + var packageName = implicitPackage.ItemSpec; + var expectedVersion = implicitPackage.GetMetadata(MetadataKeys.Version); if (string.IsNullOrEmpty(packageName) || string.IsNullOrEmpty(expectedVersion) || diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.props b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.props index 738378a59b1a..8c019f4ded32 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.props +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.props @@ -19,6 +19,9 @@ Copyright (c) .NET Foundation. All rights reserved. $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + + false diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets index bd80eec9020e..b1184344aaea 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets @@ -76,99 +76,24 @@ Copyright (c) .NET Foundation. All rights reserved. The TargetLatestRuntimePatch property can be set to true or false to explicitly opt in or out of the logic to roll forward to the latest patch, regardless of whether the app is self-contained or framework-dependent. - The RuntimeFrameworkVersion is where the actual version of the .NET Core runtime to target is stored. It is the version that is - used in the implicit PackageReference to Microsoft.NETCore.App. The RuntimeFrameworkVersion can also be set explicitly, which - will disable all the other logic that automatically selects the version of .NET Core to target. + The RuntimeFrameworkVersion is where the actual version of the .NET Core runtime to target can be set. If set, it will be + used in the implicit PackageReference to Microsoft.NETCore.App. The framework version that is written to the runtimeconfig.json file is based on the actual resolved package version of Microsoft.NETCore.App. This is to allow floating the verion number (ie the RuntimeFrameworkVersion could be set to "2.0-*". --> - - - - - - 1.0.10 - 1.1.7 - 2.0.6 - - - - 1.0.5 - 1.1.2 - - - $(BundledNETCoreAppPackageVersion) - - $(_TargetFrameworkVersionWithoutV) - - - - $(LatestPatchVersionForNetCore1_0) - $(LatestPatchVersionForNetCore1_1) - $(LatestPatchVersionForNetCore2_0) - $(LatestPatchVersionForNetCore2_1) - - - $(BundledNETCoreAppPackageVersion) - - $(_TargetFrameworkVersionWithoutV) - true false - - $(LatestNetCorePatchVersion) - $(DefaultNetCorePatchVersion) - - - - - - - true - - - - - - - - - - - - - @@ -180,11 +105,18 @@ Copyright (c) .NET Foundation. All rights reserved. true true + + + - + + + + diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.PackageDependencyResolution.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.PackageDependencyResolution.targets index 0c5c9ccb43c3..bbb14fcee06c 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.PackageDependencyResolution.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.PackageDependencyResolution.targets @@ -197,6 +197,12 @@ Copyright (c) .NET Foundation. All rights reserved. <_PackAsToolShimRuntimeIdentifiers Include="$(PackAsToolShimRuntimeIdentifiers)"/> + + + + + Date: Tue, 18 Sep 2018 22:36:23 -0700 Subject: [PATCH 10/14] Fix test failures --- .../targets/Microsoft.NET.CrossGen.targets | 11 +++++++++-- ...hedDepsJsonShouldContainVersionInformation.cs | 16 +++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.CrossGen.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.CrossGen.targets index 3ca593b1fb99..1fee24a9b003 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.CrossGen.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.CrossGen.targets @@ -258,15 +258,22 @@ Restores netcoreapp and publishes it to a temp directory + + + + + + + StorePackageVersion=%(PackageReferenceForCrossGen.Version);"/> l.Name == "Microsoft.NETCore.App"); - return getValuesCommand.GetValues().Single(); + return netCoreAppLibrary.Version.ToString(); } } } From 5f3b363b4633ff15bad85d5cdafa03f7eef06c62 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 19 Sep 2018 15:46:50 -0700 Subject: [PATCH 11/14] Add tests for implicit ASP.NET versions, and fix behavior --- .../ApplyImplicitVersions.cs | 3 - ...eckForImplicitPackageReferenceOverrides.cs | 45 +++- .../Microsoft.NET.Sdk.DefaultItems.targets | 12 +- .../ImplicitAspNetVersions.cs | 208 ++++++++++++++++++ .../ProjectConstruction/TestProject.cs | 10 +- 5 files changed, 253 insertions(+), 25 deletions(-) create mode 100644 src/Tests/Microsoft.NET.Build.Tests/ImplicitAspNetVersions.cs diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ApplyImplicitVersions.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ApplyImplicitVersions.cs index 41bd442ada89..92953602684f 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/ApplyImplicitVersions.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ApplyImplicitVersions.cs @@ -6,9 +6,6 @@ namespace Microsoft.NET.Build.Tasks { - - // TODO: Provide way to opt out of warning when Version is specified (possibly with the DisableImplicitFrameworkReferences property) - // TODO: Add behavior (and test) for duplicate PackageReferences public sealed class ApplyImplicitVersions : TaskBase { public string TargetFrameworkVersion { get; set; } diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/CheckForImplicitPackageReferenceOverrides.cs b/src/Tasks/Microsoft.NET.Build.Tasks/CheckForImplicitPackageReferenceOverrides.cs index 797469145139..4ac009a2c347 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/CheckForImplicitPackageReferenceOverrides.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/CheckForImplicitPackageReferenceOverrides.cs @@ -9,8 +9,6 @@ namespace Microsoft.NET.Build.Tasks { public class CheckForImplicitPackageReferenceOverrides : TaskBase { - const string MetadataKeyForItemsToRemove = "IsImplicitlyDefined"; - [Required] public ITaskItem [] PackageReferenceItems { get; set; } @@ -20,21 +18,44 @@ public class CheckForImplicitPackageReferenceOverrides : TaskBase [Output] public ITaskItem[] ItemsToRemove { get; set; } + [Output] + public ITaskItem[] ItemsToAdd { get; set; } + protected override void ExecuteCore() { var duplicateItems = PackageReferenceItems.GroupBy(i => i.ItemSpec, StringComparer.OrdinalIgnoreCase).Where(g => g.Count() > 1); - var duplicateItemsToRemove = duplicateItems.SelectMany(g => g.Where( - item => item.GetMetadata(MetadataKeyForItemsToRemove).Equals("true", StringComparison.OrdinalIgnoreCase))); - ItemsToRemove = duplicateItemsToRemove.ToArray(); - - foreach (var itemToRemove in ItemsToRemove) + if (duplicateItems.Any()) { - string message = string.Format(CultureInfo.CurrentCulture, Strings.PackageReferenceOverrideWarning, - itemToRemove.ItemSpec, - MoreInformationLink); - - Log.LogWarning(message); + List itemsToRemove = new List(); + List itemsToAdd = new List(); + foreach (var duplicateItemGroup in duplicateItems) + { + foreach (var item in duplicateItemGroup) + { + if (item.GetMetadata(MetadataKeys.IsImplicitlyDefined).Equals("true", StringComparison.OrdinalIgnoreCase)) + { + itemsToRemove.Add(item); + string message = string.Format(CultureInfo.CurrentCulture, Strings.PackageReferenceOverrideWarning, + item.ItemSpec, + MoreInformationLink); + + Log.LogWarning(message); + } + else + { + // For the explicit items, we want to add metadata to them so that the ApplyImplicitVersions task + // won't generate another error. The easiest way to do this is to add them both to a list of + // items to remove, and then a list of items which gets added back. + itemsToRemove.Add(item); + item.SetMetadata(MetadataKeys.AllowExplicitVersion, "true"); + itemsToAdd.Add(item); + } + } + } + + ItemsToRemove = itemsToRemove.ToArray(); + ItemsToAdd = itemsToAdd.ToArray(); } } } diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets index b1184344aaea..e3f90f0dc0c9 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets @@ -198,16 +198,14 @@ Copyright (c) .NET Foundation. All rights reserved. PackageReferenceItems="@(PackageReference)" MoreInformationLink="$(ImplicitPackageReferenceInformationLink)"> + - - - - - + + + + diff --git a/src/Tests/Microsoft.NET.Build.Tests/ImplicitAspNetVersions.cs b/src/Tests/Microsoft.NET.Build.Tests/ImplicitAspNetVersions.cs new file mode 100644 index 000000000000..006ec53ee392 --- /dev/null +++ b/src/Tests/Microsoft.NET.Build.Tests/ImplicitAspNetVersions.cs @@ -0,0 +1,208 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using FluentAssertions; +using Microsoft.NET.TestFramework; +using Microsoft.NET.TestFramework.Assertions; +using Microsoft.NET.TestFramework.Commands; +using Microsoft.NET.TestFramework.ProjectConstruction; +using NuGet.Common; +using NuGet.Frameworks; +using NuGet.ProjectModel; +using NuGet.Versioning; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.NET.Build.Tests +{ + public class ImplicitAspNetVersions : SdkTest + { + public ImplicitAspNetVersions(ITestOutputHelper log) : base(log) + { + } + + [Theory] + [InlineData("Microsoft.AspNetCore.App")] + [InlineData("Microsoft.AspNetCore.All")] + public void AspNetCoreVersionIsSetImplicitly(string aspnetPackageName) + { + var testProject = new TestProject() + { + Name = "AspNetImplicitVersion", + TargetFrameworks = "netcoreapp2.1", + IsSdkProject = true, + IsExe = true + }; + + // Add versionless PackageReference + testProject.PackageReferences.Add(new TestPackageReference(aspnetPackageName, null)); + + var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: aspnetPackageName) + .Restore(Log, testProject.Name); + + var buildCommand = new BuildCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); + + buildCommand + .Execute() + .Should() + .Pass(); + + var aspnetVersion = GetLibraryVersion(testProject, buildCommand, aspnetPackageName); + + // Version of AspNetCore packages is 2.1.1 because 2.1.0 packages had exact version constraints, which was broken + aspnetVersion.ToString().Should().Be("2.1.1"); + } + + [Theory] + [InlineData("Microsoft.AspNetCore.App")] + [InlineData("Microsoft.AspNetCore.All")] + public void AspNetCoreVersionRollsForward(string aspnetPackageName) + { + var testProject = new TestProject() + { + Name = "AspNetImplicitVersion", + TargetFrameworks = "netcoreapp2.1", + IsSdkProject = true, + IsExe = true, + + }; + + testProject.RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid(testProject.TargetFrameworks); + + // Add versionless PackageReference + testProject.PackageReferences.Add(new TestPackageReference(aspnetPackageName, null)); + + var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: aspnetPackageName) + .Restore(Log, testProject.Name); + + var buildCommand = new BuildCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); + + buildCommand + .Execute() + .Should() + .Pass(); + + var aspnetVersion = GetLibraryVersion(testProject, buildCommand, aspnetPackageName); + + // Self-contained app (because RID is specified) should roll forward to later patch + aspnetVersion.CompareTo(new SemanticVersion(2, 1, 1)).Should().BeGreaterThan(0); + } + + [Theory] + [InlineData("Microsoft.AspNetCore.App")] + [InlineData("Microsoft.AspNetCore.All")] + public void ExplicitVersionsOfAspNetCoreWarn(string aspnetPackageName) + { + var testProject = new TestProject() + { + Name = "AspNetExplicitVersion", + TargetFrameworks = "netcoreapp2.1", + IsSdkProject = true, + IsExe = true + }; + + string explicitVersion = "2.1.0"; + + testProject.PackageReferences.Add(new TestPackageReference(aspnetPackageName, explicitVersion)); + + var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: aspnetPackageName) + .Restore(Log, testProject.Name); + + var buildCommand = new BuildCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); + + buildCommand + .Execute() + .Should() + .Pass() + .And + .HaveStdOutContaining("NETSDK1071"); + + var aspnetVersion = GetLibraryVersion(testProject, buildCommand, aspnetPackageName); + + aspnetVersion.ToString().Should().Be(explicitVersion); + } + + [Theory] + [InlineData("netcoreapp2.0", "Microsoft.AspNetCore.All", "2.0.9")] + [InlineData("netcoreapp1.1", "Microsoft.AspNetCore", "1.1.7")] + public void ExplicitVersionsDontWarnForOlderVersions(string targetFramework, string packageName, string packageVersion) + { + var testProject = new TestProject() + { + Name = "AspNetPreviousVersion", + TargetFrameworks = targetFramework, + IsSdkProject = true, + IsExe = true + }; + + testProject.PackageReferences.Add(new TestPackageReference(packageName, packageVersion)); + + var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework) + .Restore(Log, testProject.Name); + + var buildCommand = new BuildCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); + + buildCommand + .Execute() + .Should() + .Pass() + .And + .NotHaveStdOutContaining("warning"); + + var aspnetVersion = GetLibraryVersion(testProject, buildCommand, packageName); + + aspnetVersion.ToString().Should().Be(packageVersion); + } + + [Fact] + public void MultipleWarningsAreGeneratedForMultipleExplicitReferences() + { + var testProject = new TestProject() + { + Name = "MultipleExplicitReferences", + TargetFrameworks = "netcoreapp2.1", + IsSdkProject = true, + IsExe = true + }; + + testProject.PackageReferences.Add(new TestPackageReference("Microsoft.NETCore.App", "2.1.0")); + testProject.PackageReferences.Add(new TestPackageReference("Microsoft.AspNetCore.App", "2.1.0")); + + var testAsset = _testAssetsManager.CreateTestProject(testProject); + + var restoreCommand = new RestoreCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); + restoreCommand + .Execute() + .Should() + .Pass() + .And + .NotHaveStdOutContaining("NETSDK1071"); + + + var buildCommand = new BuildCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); + + buildCommand + .Execute() + .Should() + .Pass() + .And + .HaveStdOutContaining("NETSDK1071") + .And + .HaveStdOutContaining("NETSDK1023"); + } + + static NuGetVersion GetLibraryVersion(TestProject testProject, BuildCommand buildCommand, string libraryName) + { + LockFile lockFile = LockFileUtilities.GetLockFile( + Path.Combine(buildCommand.GetBaseIntermediateDirectory().FullName, "project.assets.json"), + NullLogger.Instance); + + var target = lockFile.GetTarget(NuGetFramework.Parse(testProject.TargetFrameworks), testProject.RuntimeIdentifier); + var lockFileLibrary = target.Libraries.Single(l => l.Name == libraryName); + + return lockFileLibrary.Version; + } + } +} diff --git a/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs b/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs index 6e91bd2f7d77..0ffb53c2e53d 100644 --- a/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs +++ b/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs @@ -145,9 +145,13 @@ internal void Create(TestAsset targetTestAsset, string testProjectsSourceFolder) foreach (TestPackageReference packageReference in PackageReferences) { - packageReferenceItemGroup.Add(new XElement(ns + "PackageReference", - new XAttribute("Include", $"{packageReference.ID}"), - new XAttribute("Version", $"{packageReference.Version}"))); + var packageReferenceElement = new XElement(ns + "PackageReference", + new XAttribute("Include", packageReference.ID)); + if (packageReference.Version != null) + { + packageReferenceElement.Add(new XAttribute("Version", packageReference.Version)); + } + packageReferenceItemGroup.Add(packageReferenceElement); } foreach (TestPackageReference dotnetCliToolReference in DotNetCliToolReferences) From e7aab66748033f04a0c194131793acdad2b09b38 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 19 Sep 2018 19:22:38 -0700 Subject: [PATCH 12/14] Support patch version in TargetFramework property --- .../targets/Microsoft.NET.Sdk.DefaultItems.targets | 9 +++++++++ .../GivenThatWeWantToBuildANetCoreApp.cs | 3 +-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets index e3f90f0dc0c9..87215d96e85f 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets @@ -129,6 +129,15 @@ Copyright (c) .NET Foundation. All rights reserved. + + + + + $(_TargetFrameworkVersionWithoutV) + + + From 101e3fdfa1de3e145c74744f2c07a35a8e337024 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Thu, 20 Sep 2018 16:07:52 -0700 Subject: [PATCH 14/14] Apply code review feedback --- .../ApplyImplicitVersions.cs | 23 +++++++++++++++---- ...eckForImplicitPackageReferenceOverrides.cs | 7 ++---- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ApplyImplicitVersions.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ApplyImplicitVersions.cs index 92953602684f..04ed9756e504 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/ApplyImplicitVersions.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ApplyImplicitVersions.cs @@ -31,15 +31,12 @@ protected override void ExecuteCore() var packageReferencesToUpdate = new List(); - var implicitReferencesForThisFramework = ImplicitPackageReferenceVersions - .Select(item => new ImplicitPackageReferenceVersion(item)) - .Where(item => item.TargetFrameworkVersion == this.TargetFrameworkVersion) - .ToDictionary(implicitVersion => implicitVersion.Name); + var implicitVersionTable = GetApplicableImplicitVersionTable(); foreach (var packageReference in PackageReferences) { ImplicitPackageReferenceVersion implicitVersion; - if (implicitReferencesForThisFramework.TryGetValue(packageReference.ItemSpec, out implicitVersion)) + if (implicitVersionTable.TryGetValue(packageReference.ItemSpec, out implicitVersion)) { string versionOnPackageReference = packageReference.GetMetadata(MetadataKeys.Version); if (string.IsNullOrEmpty(versionOnPackageReference)) @@ -63,6 +60,22 @@ protected override void ExecuteCore() SdkBuildWarnings = buildWarnings.ToArray(); } + private Dictionary GetApplicableImplicitVersionTable() + { + var result = new Dictionary(); + foreach (var item in ImplicitPackageReferenceVersions) + { + var implicitPackageReferenceVersion = new ImplicitPackageReferenceVersion(item); + + if (implicitPackageReferenceVersion.TargetFrameworkVersion == this.TargetFrameworkVersion) + { + result.Add(implicitPackageReferenceVersion.Name, implicitPackageReferenceVersion); + } + } + + return result; + } + private sealed class ImplicitPackageReferenceVersion { private ITaskItem _item; diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/CheckForImplicitPackageReferenceOverrides.cs b/src/Tasks/Microsoft.NET.Build.Tasks/CheckForImplicitPackageReferenceOverrides.cs index 4ac009a2c347..0f41660272aa 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/CheckForImplicitPackageReferenceOverrides.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/CheckForImplicitPackageReferenceOverrides.cs @@ -36,11 +36,8 @@ protected override void ExecuteCore() if (item.GetMetadata(MetadataKeys.IsImplicitlyDefined).Equals("true", StringComparison.OrdinalIgnoreCase)) { itemsToRemove.Add(item); - string message = string.Format(CultureInfo.CurrentCulture, Strings.PackageReferenceOverrideWarning, - item.ItemSpec, - MoreInformationLink); - - Log.LogWarning(message); + + Log.LogWarning(Strings.PackageReferenceOverrideWarning, item.ItemSpec, MoreInformationLink); } else {