diff --git a/documentation/wiki/ChangeWaves-Dev.md b/documentation/wiki/ChangeWaves-Dev.md index bb4f143ac4c..de8d8e11725 100644 --- a/documentation/wiki/ChangeWaves-Dev.md +++ b/documentation/wiki/ChangeWaves-Dev.md @@ -51,7 +51,7 @@ Surround your feature with the following: If you need to condition a Task or Target, use the built in `AreFeaturesEnabled` function. ```xml - + ``` diff --git a/documentation/wiki/ChangeWaves.md b/documentation/wiki/ChangeWaves.md index e6b66012eb5..5d3feeccf3a 100644 --- a/documentation/wiki/ChangeWaves.md +++ b/documentation/wiki/ChangeWaves.md @@ -24,6 +24,7 @@ A wave of features is set to "rotate out" (i.e. become standard functionality) t ## Current Rotation of Change Waves ### 17.6 +- [Parse invalid property under target](https://github.com/dotnet/msbuild/pull/8190) - [Eliminate project string cache](https://github.com/dotnet/msbuild/pull/7965) - [Log an error when no provided search path for an import exists](https://github.com/dotnet/msbuild/pull/8095) diff --git a/src/Build.OM.UnitTests/Construction/ProjectTargetElement_Tests.cs b/src/Build.OM.UnitTests/Construction/ProjectTargetElement_Tests.cs index eb7d71c2634..585c10071f7 100644 --- a/src/Build.OM.UnitTests/Construction/ProjectTargetElement_Tests.cs +++ b/src/Build.OM.UnitTests/Construction/ProjectTargetElement_Tests.cs @@ -5,9 +5,13 @@ using System.IO; using System.Xml; using Microsoft.Build.Construction; +using Microsoft.Build.Evaluation; +using Microsoft.Build.Framework; +using Microsoft.Build.Shared; +using Shouldly; +using Xunit; using InvalidProjectFileException = Microsoft.Build.Exceptions.InvalidProjectFileException; -using Xunit; #nullable disable @@ -339,6 +343,49 @@ public void SetReturns() Assert.True(project.HasUnsavedChanges); } + /// + /// Parse invalid property under target + /// + [Theory] + [InlineData(true)] + [InlineData(false)] + public void ReadInvalidPropertyUnderTarget(bool enableNewBehavior) + { + using (TestEnvironment env = TestEnvironment.Create()) + { + ChangeWaves.ResetStateForTests(); + if (!enableNewBehavior) + { + env.SetEnvironmentVariable("MSBUILDDISABLEFEATURESFROMVERSION", ChangeWaves.Wave17_6.ToString()); + BuildEnvironmentHelper.ResetInstance_ForUnitTestsOnly(); + } + + string projectFile = @" + + + m + + "; + TransientTestFile file = env.CreateFile("proj.csproj", projectFile); + ProjectCollection collection = new ProjectCollection(); + var error = Assert.Throws(() => + { + collection.LoadProject(file.Path).Build().ShouldBeTrue(); + }); + + error.ErrorCode.ShouldMatch("MSB4067"); + var expectedString = ""; + if (ChangeWaves.AreFeaturesEnabled(ChangeWaves.Wave17_6)) + { + error.Message.ShouldMatch(expectedString); + } + else + { + error.Message.ShouldNotMatch(expectedString); + } + } + } + /// /// Helper to get an empty ProjectTargetElement with various attributes and two tasks /// diff --git a/src/Build/Evaluation/ProjectParser.cs b/src/Build/Evaluation/ProjectParser.cs index 6959e3709b0..fd9f087f7a9 100644 --- a/src/Build/Evaluation/ProjectParser.cs +++ b/src/Build/Evaluation/ProjectParser.cs @@ -6,6 +6,7 @@ using Microsoft.Build.Shared; using System; using System.Collections.Generic; +using System.Xml; using Expander = Microsoft.Build.Evaluation.Expander; using ProjectXmlUtilities = Microsoft.Build.Internal.ProjectXmlUtilities; @@ -634,6 +635,14 @@ private ProjectTargetElement ParseProjectTargetElement(XmlElementWithLocation el if (onError != null) { ProjectErrorUtilities.ThrowInvalidProject(onError.Location, "NodeMustBeLastUnderElement", XMakeElements.onError, XMakeElements.target, childElement.Name); + } + if (ChangeWaves.AreFeaturesEnabled(ChangeWaves.Wave17_6)) + { + if (childElement.ChildNodes.Count == 1 && childElement.FirstChild.NodeType == XmlNodeType.Text) + { + // If the element has inner text and no other child elements except text, then this should be a property and throw invalid child element of + ProjectErrorUtilities.ThrowInvalidProject(childElement.Location, "PropertyOutsidePropertyGroupInTarget", childElement.Name, childElement.ParentNode.Name); + } } child = ParseProjectTaskElement(childElement, target); diff --git a/src/Build/Resources/Strings.resx b/src/Build/Resources/Strings.resx index 6e06bc6e423..e6682e991cc 100644 --- a/src/Build/Resources/Strings.resx +++ b/src/Build/Resources/Strings.resx @@ -1271,6 +1271,10 @@ MSB4067: The element <{0}> beneath element <{1}> is unrecognized. {StrBegin="MSB4067: "} + + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + {StrBegin="MSB4067: "} + MSB4173: The element <{0}> beneath element <{1}> is invalid because a child element with that name already exists {StrBegin="MSB4173: "} diff --git a/src/Build/Resources/xlf/Strings.cs.xlf b/src/Build/Resources/xlf/Strings.cs.xlf index fc31029e3e0..48864ef5448 100644 --- a/src/Build/Resources/xlf/Strings.cs.xlf +++ b/src/Build/Resources/xlf/Strings.cs.xlf @@ -328,6 +328,11 @@ Počáteční hodnota vlastnosti: $({0})={1} Zdroj: {2} + + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + {StrBegin="MSB4067: "} + MSB4274: Disabling the inproc node leads to performance degradation when using project cache plugins that emit proxy build requests. MSB4274: Zakázání uzlu inproc způsobí snížení výkonu při používání modulů plug-in mezipaměti projektu, které vysílají žádosti o sestavení proxy serveru. @@ -1819,7 +1824,7 @@ MSB4067: The element <{0}> beneath element <{1}> is unrecognized. - MSB4067: Element <{0}> pod elementem <{1}> nebyl rozpoznán. + MSB4067: Element <{0}> pod elementem <{1}> nebyl rozpoznán. {StrBegin="MSB4067: "} diff --git a/src/Build/Resources/xlf/Strings.de.xlf b/src/Build/Resources/xlf/Strings.de.xlf index 1bfb8341b04..b2ed8de5419 100644 --- a/src/Build/Resources/xlf/Strings.de.xlf +++ b/src/Build/Resources/xlf/Strings.de.xlf @@ -328,6 +328,11 @@ Anfangswert der Eigenschaft: $({0})="{1}", Quelle: {2} + + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + {StrBegin="MSB4067: "} + MSB4274: Disabling the inproc node leads to performance degradation when using project cache plugins that emit proxy build requests. MSB4274: Das Deaktivieren des In-Process-Knotens führt zu Leistungseinbußen bei der Verwendung von Projektcache-Plug-Ins, die Proxybuildanforderungen ausgeben. @@ -1819,7 +1824,7 @@ MSB4067: The element <{0}> beneath element <{1}> is unrecognized. - MSB4067: Das <{0}>-Element unterhalb des <{1}>-Elements ist unbekannt. + MSB4067: Das <{0}>-Element unterhalb des <{1}>-Elements ist unbekannt. {StrBegin="MSB4067: "} diff --git a/src/Build/Resources/xlf/Strings.es.xlf b/src/Build/Resources/xlf/Strings.es.xlf index 9381108a7e8..1465731b01f 100644 --- a/src/Build/Resources/xlf/Strings.es.xlf +++ b/src/Build/Resources/xlf/Strings.es.xlf @@ -328,6 +328,11 @@ Valor inicial de la propiedad: $({0})="{1}" Origen: {2} + + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + {StrBegin="MSB4067: "} + MSB4274: Disabling the inproc node leads to performance degradation when using project cache plugins that emit proxy build requests. MSB4274: Al deshabilitar el nodo InProc, se degrada el rendimiento cuando use los complementos de caché de proyectos que emiten solicitudes de compilación de proxy. @@ -1819,7 +1824,7 @@ MSB4067: The element <{0}> beneath element <{1}> is unrecognized. - MSB4067: No se reconoce el subelemento <{0}> del elemento <{1}>. + MSB4067: No se reconoce el subelemento <{0}> del elemento <{1}>. {StrBegin="MSB4067: "} diff --git a/src/Build/Resources/xlf/Strings.fr.xlf b/src/Build/Resources/xlf/Strings.fr.xlf index 2b690c854dd..88530ab409b 100644 --- a/src/Build/Resources/xlf/Strings.fr.xlf +++ b/src/Build/Resources/xlf/Strings.fr.xlf @@ -328,6 +328,11 @@ Valeur initiale de la propriété : $({0})="{1}" Source : {2} + + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + {StrBegin="MSB4067: "} + MSB4274: Disabling the inproc node leads to performance degradation when using project cache plugins that emit proxy build requests. MSB4274: la désactivation du nœud inproc entraîne une détérioration des performances lors de l’utilisation de plug-ins de cache de projet qui émettent des requêtes de build proxy. @@ -1819,7 +1824,7 @@ MSB4067: The element <{0}> beneath element <{1}> is unrecognized. - MSB4067: L'élément "{0}" situé sous l'élément <{1}> n'est pas reconnu. + MSB4067: L'élément "{0}" situé sous l'élément <{1}> n'est pas reconnu. {StrBegin="MSB4067: "} diff --git a/src/Build/Resources/xlf/Strings.it.xlf b/src/Build/Resources/xlf/Strings.it.xlf index 3c0e4bd0080..e6e534d6ecd 100644 --- a/src/Build/Resources/xlf/Strings.it.xlf +++ b/src/Build/Resources/xlf/Strings.it.xlf @@ -328,6 +328,11 @@ Valore iniziale della proprietà: $({0})="{1}". Origine: {2} + + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + {StrBegin="MSB4067: "} + MSB4274: Disabling the inproc node leads to performance degradation when using project cache plugins that emit proxy build requests. MSB4274: la disabilitazione del nodo InProc porta a una riduzione del livello delle prestazioni quando si usano plug-in della cache del progetto che emettono richieste di compilazione proxy. @@ -1819,7 +1824,7 @@ MSB4067: The element <{0}> beneath element <{1}> is unrecognized. - MSB4067: elemento <{0}> sotto l'elemento <{1}> non riconosciuto. + MSB4067: elemento <{0}> sotto l'elemento <{1}> non riconosciuto. {StrBegin="MSB4067: "} diff --git a/src/Build/Resources/xlf/Strings.ja.xlf b/src/Build/Resources/xlf/Strings.ja.xlf index bedf8d61abf..ab2200b7462 100644 --- a/src/Build/Resources/xlf/Strings.ja.xlf +++ b/src/Build/Resources/xlf/Strings.ja.xlf @@ -328,6 +328,11 @@ プロパティの初期値: $({0})="{1}" ソース: {2} + + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + {StrBegin="MSB4067: "} + MSB4274: Disabling the inproc node leads to performance degradation when using project cache plugins that emit proxy build requests. MSB4274: プロキシ・ビルド要求を出すプロジェクト キャッシュ プラグインを使用する場合、InProc ノードを無効にするとパフォーマンスが低下します。 @@ -1819,7 +1824,7 @@ MSB4067: The element <{0}> beneath element <{1}> is unrecognized. - MSB4067: 要素 <{1}> の下の要素 <{0}> は認識されていません。 + MSB4067: 要素 <{1}> の下の要素 <{0}> は認識されていません。 {StrBegin="MSB4067: "} diff --git a/src/Build/Resources/xlf/Strings.ko.xlf b/src/Build/Resources/xlf/Strings.ko.xlf index 72b26912e06..3532158efc9 100644 --- a/src/Build/Resources/xlf/Strings.ko.xlf +++ b/src/Build/Resources/xlf/Strings.ko.xlf @@ -328,6 +328,11 @@ 속성 초기 값: $({0})="{1}" 소스: {2} + + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + {StrBegin="MSB4067: "} + MSB4274: Disabling the inproc node leads to performance degradation when using project cache plugins that emit proxy build requests. MSB4274: 프록시 빌드 요청을 내보내는 프로젝트 캐시 플러그 인을 사용할 때 inproc 노드를 사용하지 않도록 설정하면 성능이 저하됩니다. @@ -1819,7 +1824,7 @@ MSB4067: The element <{0}> beneath element <{1}> is unrecognized. - MSB4067: <{1}> 요소 아래의 <{0}> 요소를 인식할 수 없습니다. + MSB4067: <{1}> 요소 아래의 <{0}> 요소를 인식할 수 없습니다. {StrBegin="MSB4067: "} diff --git a/src/Build/Resources/xlf/Strings.pl.xlf b/src/Build/Resources/xlf/Strings.pl.xlf index ea709e424e9..2aa8a1eea89 100644 --- a/src/Build/Resources/xlf/Strings.pl.xlf +++ b/src/Build/Resources/xlf/Strings.pl.xlf @@ -328,6 +328,11 @@ Wartość początkowa właściwości: $({0})=„{1}” Źródło: {2} + + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + {StrBegin="MSB4067: "} + MSB4274: Disabling the inproc node leads to performance degradation when using project cache plugins that emit proxy build requests. MSB4274: wyłączenie węzła InProc prowadzi do obniżenia wydajności, gdy używane są wtyczki pamięci podręcznej projektu, które emitują żądania kompilowania serwera proxy. @@ -1819,7 +1824,7 @@ MSB4067: The element <{0}> beneath element <{1}> is unrecognized. - MSB4067: Element <{0}> znajdujący się pod elementem <{1}> nie został rozpoznany. + MSB4067: Element <{0}> znajdujący się pod elementem <{1}> nie został rozpoznany. {StrBegin="MSB4067: "} diff --git a/src/Build/Resources/xlf/Strings.pt-BR.xlf b/src/Build/Resources/xlf/Strings.pt-BR.xlf index 12559cec995..8ac4b9c5048 100644 --- a/src/Build/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Build/Resources/xlf/Strings.pt-BR.xlf @@ -328,6 +328,11 @@ Valor inicial da propriedade: $({0})="{1}" Origem: {2} + + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + {StrBegin="MSB4067: "} + MSB4274: Disabling the inproc node leads to performance degradation when using project cache plugins that emit proxy build requests. MSB4274: desativar o nó inproc leva à degradação do desempenho ao usar plug-ins de cache de projeto que emitem solicitações de construção de proxy. @@ -1819,7 +1824,7 @@ MSB4067: The element <{0}> beneath element <{1}> is unrecognized. - MSB4067: O elemento <{0}> abaixo do elemento <{1}> não é reconhecido. + MSB4067: O elemento <{0}> abaixo do elemento <{1}> não é reconhecido. {StrBegin="MSB4067: "} diff --git a/src/Build/Resources/xlf/Strings.ru.xlf b/src/Build/Resources/xlf/Strings.ru.xlf index 6ca8431952b..c2ba83a99f7 100644 --- a/src/Build/Resources/xlf/Strings.ru.xlf +++ b/src/Build/Resources/xlf/Strings.ru.xlf @@ -328,6 +328,11 @@ Начальное значение свойства: $({0})="{1}" Источник: {2} + + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + {StrBegin="MSB4067: "} + MSB4274: Disabling the inproc node leads to performance degradation when using project cache plugins that emit proxy build requests. MSB4274: Отключение внутрипроцессного узла приводит к замедлению при использовании плагинов кэша проекта, которые создают запросы на сборку прокси-сервера. @@ -1819,7 +1824,7 @@ MSB4067: The element <{0}> beneath element <{1}> is unrecognized. - MSB4067: неопознанный элемент <{0}> в элементе <{1}>. + MSB4067: неопознанный элемент <{0}> в элементе <{1}>. {StrBegin="MSB4067: "} diff --git a/src/Build/Resources/xlf/Strings.tr.xlf b/src/Build/Resources/xlf/Strings.tr.xlf index 1917bb7e6ce..61af460f9b7 100644 --- a/src/Build/Resources/xlf/Strings.tr.xlf +++ b/src/Build/Resources/xlf/Strings.tr.xlf @@ -328,6 +328,11 @@ Özellik başlangıç değeri: $({0})="{1}" Kaynak: {2} + + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + {StrBegin="MSB4067: "} + MSB4274: Disabling the inproc node leads to performance degradation when using project cache plugins that emit proxy build requests. MSB4274: InProc düğümünün devre dışı bırakılması, ara sunucu oluşturma istekleri gönderen proje önbelleği eklentileri kullanılırken performans düşüşüne yol açar. @@ -1819,7 +1824,7 @@ MSB4067: The element <{0}> beneath element <{1}> is unrecognized. - MSB4067: <{1}> öğesinin altındaki <{0}> öğesi tanınmıyor. + MSB4067: <{1}> öğesinin altındaki <{0}> öğesi tanınmıyor. {StrBegin="MSB4067: "} diff --git a/src/Build/Resources/xlf/Strings.zh-Hans.xlf b/src/Build/Resources/xlf/Strings.zh-Hans.xlf index 082781250dd..001ad949ab3 100644 --- a/src/Build/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Build/Resources/xlf/Strings.zh-Hans.xlf @@ -328,6 +328,11 @@ 属性初始值: $({0})=“{1}”,源: {2} + + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + {StrBegin="MSB4067: "} + MSB4274: Disabling the inproc node leads to performance degradation when using project cache plugins that emit proxy build requests. MSB4274: 使用发出代理构建请求的项目缓存插件时,禁用 inproc 节点会导致性能下降。 @@ -1819,7 +1824,7 @@ MSB4067: The element <{0}> beneath element <{1}> is unrecognized. - MSB4067: 无法识别元素 <{1}> 下面的元素 <{0}>。 + MSB4067: 无法识别元素 <{1}> 下面的元素 <{0}>。 {StrBegin="MSB4067: "} diff --git a/src/Build/Resources/xlf/Strings.zh-Hant.xlf b/src/Build/Resources/xlf/Strings.zh-Hant.xlf index 87e681bf25b..343b646aad6 100644 --- a/src/Build/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Build/Resources/xlf/Strings.zh-Hant.xlf @@ -328,6 +328,11 @@ 屬性初始值: $({0})="{1}" 來源: {2} + + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + MSB4067: The element <{0}> beneath element <{1}> is unrecognized. If you intended this to be a property, enclose it within a <PropertyGroup> element. + {StrBegin="MSB4067: "} + MSB4274: Disabling the inproc node leads to performance degradation when using project cache plugins that emit proxy build requests. MSB4274: 停用 inproc 節點會在使用可發出 proxy 組建要求的專案快取外掛程式時,導致效能降低。 @@ -1819,7 +1824,7 @@ MSB4067: The element <{0}> beneath element <{1}> is unrecognized. - MSB4067: 無法辨認項目 <{1}> 下的項目 <{0}>。 + MSB4067: 無法辨認項目 <{1}> 下的項目 <{0}>。 {StrBegin="MSB4067: "}