Skip to content

Instantly share code, notes, and snippets.

@milannankov
Last active October 5, 2018 12:39
Show Gist options
  • Save milannankov/999de479706128da25f161aea060b837 to your computer and use it in GitHub Desktop.
Save milannankov/999de479706128da25f161aea060b837 to your computer and use it in GitHub Desktop.
copy-output-files-msbuild
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CopyDestionationPath>.\MyDestinationPath</CopyDestionationPath>
<BuildDependsOn>
$(BuildDependsOn);
CopyOutputToDestination;
</BuildDependsOn>
</PropertyGroup>
<Target Name="CopyOutputToDestination">
<ItemGroup>
<OutputFiles Include="$(OutDir)**\*"></OutputFiles>
</ItemGroup>
<Message Text="Copying output file to destination: @(OutputFiles)" Importance="high"/>
<Copy SourceFiles="@(OutputFiles)"
DestinationFolder="$(CopyDestionationPath)\%(RecursiveDir)"
OverwriteReadOnlyFiles="true"></Copy>
</Target>
</Project>
<!-- Rest of .csproj -->
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildProjectDirectory)\Build\copy-output.targets" />
</Project>
@valgur
Copy link

valgur commented Oct 5, 2018

Thanks a lot for the script!
Just one minor note - there's a typo on lines 6 and 24: CopyDestionationPath should be CopyDestinationPath.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment