Skip to content

Instantly share code, notes, and snippets.

@xiaomi7732
Last active February 4, 2022 04:13
Show Gist options
  • Save xiaomi7732/ad69c040c1468682e1d6173ee9b2509e to your computer and use it in GitHub Desktop.
Save xiaomi7732/ad69c040c1468682e1d6173ee9b2509e to your computer and use it in GitHub Desktop.
Copy files to build output

This is a cheetsheet to copy files to output directory in a MSBuild project file.

For example, this will copy settings.json to output directory when the one in current folder is newer.

<Project Sdk="Microsoft.NET.Sdk">
  ...
  <ItemGroup>
    <!-- Build action is `None`, and the option for copy to output directory could be `Always` or `PreserveNewest` -->
    <None Include="./settings.json" CopyToOutputDirectory="PreserveNewest" />
  </ItemGroup>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment