I have the following MSBuild .proj file content:
<ItemGroup>
<Exclude Include="*2.*"></Exclude>
</ItemGroup>
<ItemGroup>
<!-- I have 3 files in the current directory: File1.cpp, File2.cpp and File3.cpp -->
<ModuleInclude Include="*.cpp" Exclude="@(Exclude)"></ModuleInclude>
<!-- I have 3 files in the Subfolder directory: eFile1.h, eFile2.h and eFile3.h -->
<ModuleInclude Include="Subfolder\*.h" Exclude="@(Exclude->'Subfolder\%(identity)')"></ModuleInclude>
</ItemGroup>
<Target Name="Default">
<Message Text="ModuleIncludes: %(ModuleInclude.identity)" />
<Message Text="Excluded Items: @(Exclude)" />
<Message Text="Excluded Subfolder Items: @(Exclude->'Subfolder\%(identity)')" />
</Target>
I see the following output:
ModuleIncludes: File1.cpp
ModuleIncludes: File3.cpp
ModuleIncludes: Subfolder\eFile1.h
ModuleIncludes: Subfolder\eFile2.h
ModuleIncludes: Subfolder\eFile3.h
Excluded Items: File2.cpp
Excluded Subfolder Items: Subfolder\File2.cpp
What I really need is to have the following Subfolder files included
ModuleIncludes: Subfolder\eFile1.h
ModuleIncludes: Subfolder\eFile3.h
The excluded subfolder items therefore should be:
Excluded Subfolder Items: Subfolder\eFile2.h
To be able to get such an output I would need the expression
Subfolder\*2.*
The syntax that I am using
@(Exclude->'Subfolder\%(identity)')
does not give me what I need. What would the correct syntax be? Or is this not possible?