0

I want to copy all build output files to the folder \\server\assemblies using MSBuild, additionally to copying them to the default $(OutDir). I already had a look at the MSBuild target CopyFilesToOutputFolder, but I am unsure of whether I should just go ahead and duplicate that target (or any of its subtargets).

What I am looking for, is an item list, that I can pass into the Copy task, to achieve that behavior. This is what I currently have:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <CustomOutDir>\\server\assemblies\</CustomOutDir>
    </PropertyGroup>
    <Target Name="AfterBuild">
        <Copy SourceFiles="@(FileWrites)" DestinationFolder="$(CustomOutDir)" />
    </Target>
</Project>

I don't know if @(FileWrites) only contains all the files written to the output Folder, or if it may contain other temporary files as well. Is there another item list macro that I could use?

Ehssan
  • 739
  • 6
  • 15
  • Alternatively you could just list all files in OutDir and copy those. Then you're sure you won't miss any, I wouldn't be suprised if there were multiple targets which dump things in OutDir (eg referenced dlls etc) so there won't be a single list having all items. – stijn Aug 12 '16 at 18:57
  • The problem with that suggestion is, that all projects in the solution put their build outputs in the same `$(OutDir)` (as does the team build) – Ehssan Aug 12 '16 at 19:17

0 Answers0