You could create a Target that looks like this:
<Target Name="CopyFiles" DependsOnTargets="YourBuildTargets">
<CreateItem Include="YourSolutionPath\bin\$(Configuration)\*.*">
<Output ItemName="YourProjectOutputFiles" TaskParameter="Include"></Output>
</CreateItem>
<Copy SourceFiles="@(YourProjectOutputFiles)" DestinationFolder="$(DestinationFolder)"></Copy>
</Target>
This will create a target called CopyFiles
which depends on the completion of YourBuildTargets
(You can put multiple dependencies in there, separated with semi colons). It describes an Item which includes all of the files (*.*) in the project directory. Then it runs the Copy
command, and copies the files described by the item to the destination folder. If you have lots of projects all being build by 1 MSBuild script, you would have a CreateItem
node for each project to index the files, and a corresponding Copy
node to perform the copy.
Or if you just want to do this for each project separately, just put this block inside each .csproj file.
Now just include the CopyFiles
target in the list of targets that gets build by your script.