Take, for example, the following msbuild file and directory structure:
<Project DefaultTargets="Test"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<FileList Include="Tests\**" Exclude="Tests\Folder2\**" />
</ItemGroup>
<Target Name="Test">
<Message Text="@(FileList->'%(RecursiveDir)%(Filename)%(Extension)', '%0D%0A')" />
</Target>
</Project>
and
Tests
-- Folder1
-- folder1-test1.txt
-- folder1-test2.txt
-- Folder2
-- folder2-test1.txt
-- folder2-test2.txt
This will produce the expected results:
Folder1\folder1-test1.txt
Folder1\folder1-test2.txt
However if I change the FileList ItemGroup to any of the following it lists all 4 files.
<FileList Include="Tests\**" Exclude="Tests/Folder2/**"/>
<FileList Include="Tests/**" Exclude="Tests\Folder2\**"/>
<FileList Include="Tests/**" Exclude="Tests/Folder2/**"/>
<FileList Include="Tests\\**" Exclude="Tests\Folder2\**"/>
<FileList Include="Tests\..\Tests\**" Exclude="Tests\Folder2\**"/>
Is this intended behavior and if so why?