i'm taking a list of files *.config
and copying them to a list of directories. The directories are relative to a path C:\branches\
have a name and then the name.UnitTest.
so the copy looks like this without being refactored/batched:
<Target Name="CopyClientConfigs">
<ItemGroup>
<ClientConfigDestinations Include="$(LocalSourcePath)\Module1\Module1.UnitTest\;
$(LocalSourcePath)\Module2\Module2.UnitTest\;
$(LocalSourcePath)\CommonControls\Module3\Module3.UnitTest\;
$(LocalSourcePath)\Administration\Module4\Module4.UnitTest\;
$(LocalSourcePath)\IndividualControls\Configuration\Module5\Module5.UnitTest\" />
<ClientConfigs
Include="$(ClientConfigPath)\*.config"
Exclude="$(ClientConfigPath)\P*.config" >
</ClientConfigs>
</ItemGroup>
<Copy
SourceFiles="@(ClientConfigs)"
DestinationFolder="%(ClientConfigDestinations.FullPath)"
/>
What I want is to be able to use this ItemGroup
<ItemGroup>
<MyModules Include="$(LocalSourcePath)\Module1;
$(LocalSourcePath)\Module2;
$(LocalSourcePath)\CommonControls\Module3;
$(LocalSourcePath)\Administration\Module4;
$(LocalSourcePath)\IndividualControls\Configuration\Module5"
/>
So the task would be like
Copy
SourceFiles="@(ClientConfigs)"
DestinationFolder="%(ClientConfigDestinations.FullPath)\*.UnitTest\"
/>
Or better
Copy
SourceFiles="@(ClientConfigs)"
DestinationFolder="%(ClientConfigDestinations.FullPath)\%(ClientConfigDestinations.NameOnly).UnitTest\"
/>
How do I refactor or properly batch this operation?