I have the following piece of msbuild code:
C:\\DirA\\
C:\\DirB\\
You should be able to generate an ItemGroup containing the Dirs and then % on that.
Or you can do 2 explicit calls:
I haven't tested either syntax, but am relatively more confident of the second.
(The answer, if there is one, is in my Sayed Hashimi book on my desk - you'll have to wait until the first of: