diff options
author | Matt Ward <matt.ward@microsoft.com> | 2018-04-13 19:38:54 +0300 |
---|---|---|
committer | Matt Ward <matt.ward@microsoft.com> | 2018-04-13 19:38:54 +0300 |
commit | c4d7ac7372464a0875acd7a13c6dc41838757c6e (patch) | |
tree | b9439b4e8cf17a9b89d8a0e2e6a39f3a0db157f1 /main/src/core | |
parent | e72dcdcd3b682df59f578e714634a81f7c90af25 (diff) |
[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.
<ItemGroup>
<Compile Include="..\**\*.cs">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
</Compile>
</ItemGroup>
On saving the project Compile Update items would be added for each
file included by the file glob.
<ItemGroup>
<Compile Update="..\Test\Class1.cs">
<Link>Class1.cs</Link>
</Compile>
</ItemGroup>
Fixes VSTS #527721 - Overriding globs
Diffstat (limited to 'main/src/core')
-rw-r--r-- | main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildValueType.cs | 5 | ||||
-rw-r--r-- | main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs | 2 |
2 files changed, 7 insertions, 0 deletions
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 (); |