Skip to content

Instantly share code, notes, and snippets.

@aaronmorgan
Created September 1, 2019 03:57
Show Gist options
  • Save aaronmorgan/31927380d65b8aad85ad731f40540a22 to your computer and use it in GitHub Desktop.
Save aaronmorgan/31927380d65b8aad85ad731f40540a22 to your computer and use it in GitHub Desktop.
Better option than marking files as embedded resources, particularly when working on cross platform environments with strings.
.csproj
```
<ItemGroup>
<TestData Include="./SampleFiles/**" />
</ItemGroup>
<Target Name="CopyCustomContent" AfterTargets="AfterBuild">
<Copy SourceFiles="@(TestData)" DestinationFolder="$(OutDir)/TestData" SkipUnchangedFiles="true" />
</Target>
```
From the Microsoft documentation: https://docs.microsoft.com/en-us/visualstudio/msbuild/copy-task?view=vs-2019
@aaronmorgan
Copy link
Author

DestinationFolder also supports recursive copying, e.g.

<Copy SourceFiles="@(TestData)" DestinationFolder="$(OutputPath)/TestData/%(RecursiveDir)" SkipUnchangedFiles="true" />

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