Copying files can be done with the following code snippet which handles antivirus programs and subdirectories
<ItemGroup>
<SomeAppStuff Include="$(SolutionDir)\ProjectXXX\bins\**\*.*" />
</ItemGroup>
<Copy
SourceFiles="@(SomeAppStaff)"
DestinationFolder="$(OutputPath)\%(RecursiveDir)"
SkipUnchangedFiles="true"
OverwriteReadOnlyFiles="true"
Retries="3"
RetryDelayMilliseconds="300"/>
Specifying $(OutputPath)\%(RecursiveDir)
will ask Copy task to respect subfolders, so it will place subfolders of source directory to subfolders of target directories.
SkipUnchangedFiles
will increase build speed on computers with enough memory, because Windows optimizes IO for frequently used files when there's enough RAM.
Retries
and RetryDelayMilliseconds
handles issues related
a) Compressed NTFS file system, when builds fails in seldom cases b) Antivirus Software with SSD drives.