Quantcast
Channel: Windows – delog
Viewing all articles
Browse latest Browse all 44

Recursively copy to output in msbuild project

$
0
0

I have this very specific need to copy all files and folders from a source folder, to the project build output, akin to xcopy. Here’s an AfterBuild target that does that.

  <Target Name="AfterBuild">
    <ItemGroup>
      <HtmlContentSource Include="..\html\**\*.*" Exclude="Web.config"/>
    </ItemGroup>
    <Message Text="### Copy HTML content ###" Importance="high" />
    <Copy
        SourceFiles="@(HtmlContentSource)"
        DestinationFiles="@(HtmlContentSource -> '$(OutputPath)\html\%(RecursiveDir)%(Filename)%(Extension)')"
        SkipUnchangedFiles="true"
    />
  </Target>

It uses MSBuild transforms.


Filed under: .NET, Windows

Viewing all articles
Browse latest Browse all 44

Trending Articles