diff --git a/src/Build.UnitTests/Evaluation/Evaluator_Tests.cs b/src/Build.UnitTests/Evaluation/Evaluator_Tests.cs index 4f9b2b14f92..117da04ce76 100644 --- a/src/Build.UnitTests/Evaluation/Evaluator_Tests.cs +++ b/src/Build.UnitTests/Evaluation/Evaluator_Tests.cs @@ -96,6 +96,41 @@ public void VerifyLoadingImportScenarios(string importParameter, bool shouldSucc } } + [Theory] + [InlineData("(test")] + [InlineData("@@@test")] + [InlineData(@")(!!test")] + public void VerifyItemsUpdateIsHandledForAnyProjectPath(string projectPathCandidate) + { + using (TestEnvironment env = TestEnvironment.Create()) + { + TransientTestFolder projDirectory = env.CreateFolder(Path.Combine(env.CreateNewTempPath().TempPath, projectPathCandidate), createFolder: true); + TransientTestFile projectFile = env.CreateFile(projDirectory, "project.proj", @" + + + + + + + + + + + + Metadata('NewTestLabels'))"" /> + + +"); + Project project = new(projectFile.Path); + MockLogger logger = new(); + var result = project.Build(logger); + + result.ShouldBeTrue(); + project.AllEvaluatedItems.Where(ei => ei.ItemType == "ItemCheck" && ei.Metadata.Any(m => m.EvaluatedValue == "Dummy")).ShouldNotBeEmpty(); + } + } + // Some of these are also tested elsewhere, but this consolidates related tests in one spot. public static IEnumerable ImportLoadingScenarioTestData { diff --git a/src/Build/Evaluation/LazyItemEvaluator.cs b/src/Build/Evaluation/LazyItemEvaluator.cs index 16e9586a71b..d56d20dddde 100644 --- a/src/Build/Evaluation/LazyItemEvaluator.cs +++ b/src/Build/Evaluation/LazyItemEvaluator.cs @@ -384,7 +384,7 @@ private static OrderedItemDataCollection.Builder ComputeItems(LazyItemList lazyI break; } - string fullPath = FileUtilities.GetFullPath(frag.TextFragment, frag.ProjectDirectory); + string fullPath = FileUtilities.NormalizePathForComparisonNoThrow(frag.TextFragment, frag.ProjectDirectory); if (itemsWithNoWildcards.ContainsKey(fullPath)) { // Another update will already happen on this path. Make that happen before evaluating this one.