From c4d7ac7372464a0875acd7a13c6dc41838757c6e Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Fri, 13 Apr 2018 17:38:54 +0100 Subject: [Core] Fix MSBuild items added for globs with link metadata A project containing the following MSBuild file globs would have extra MSBuild items added when the project file was saved. %(RecursiveDir)%(Filename)%(Extension) On saving the project Compile Update items would be added for each file included by the file glob. Class1.cs Fixes VSTS #527721 - Overriding globs --- .../MonoDevelop.Projects.MSBuild/MSBuildValueType.cs | 5 +++++ main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs | 2 ++ 2 files changed, 7 insertions(+) (limited to 'main/src/core') diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildValueType.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildValueType.cs index 2e548ef0ed..32fa107420 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildValueType.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildValueType.cs @@ -45,6 +45,7 @@ namespace MonoDevelop.Projects.MSBuild class PathValueType: MSBuildValueType { static readonly char [] pathSep = { '\\' }; + static string currentDirectoryPrefix = @".\"; public override bool Equals (string ob1, string ob2) { @@ -52,6 +53,10 @@ namespace MonoDevelop.Projects.MSBuild return true; if (ob1 == null || ob2 == null) return string.IsNullOrEmpty (ob1) && string.IsNullOrEmpty (ob2);//Empty or null path is same thing + if (ob1.StartsWith (currentDirectoryPrefix, StringComparison.OrdinalIgnoreCase)) + ob1 = ob1.Substring (currentDirectoryPrefix.Length); + if (ob2.StartsWith (currentDirectoryPrefix, StringComparison.OrdinalIgnoreCase)) + ob2 = ob2.Substring (currentDirectoryPrefix.Length); return ob1.TrimEnd (pathSep) == ob2.TrimEnd (pathSep); } } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs index 81781f78c8..bba9a973a2 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs @@ -3823,6 +3823,8 @@ namespace MonoDevelop.Projects if (p2 == null || !p.ValueType.Equals (p.Value, p2.UnevaluatedValue)) { if (generateNewUpdateItem) continue; + if (p2?.UnevaluatedValue != null && p2.UnevaluatedValue.Contains ('%') && p.ValueType.Equals (p.Value, p2.Value)) + continue; if (updateItem == null) { updateItems = FindUpdateItemsForItem (globItem, item.Include).ToList (); updateItem = updateItems.LastOrDefault (); -- cgit v1.2.3