How to set an entire folder of files to copy always (or how to make files come in copy always as default) in Visual Studio 2019

Viewed 354

I would like an easier way to set the files in my solution to copy always without having to manually set each one (I have a lot of test files in a folder in one of my test projects and it's tedious to go through and set each one individually).

The only thing that works for me now is selecting each file and then changing the properties at once, but is there a way to have them come in as copy always so I don't have to worry about forgetting to set them and then run into problems when I'm testing because the files weren't copied to the output directory?

2 Answers

I have looked into many things to get this to work but have not succeeded. The only way to set the properties on your file is to do it individually. The only thing that I found was that you can highlight as many files as you want at once and set their properties just no setting them as they come in. Hopefully this was helpful for anyone looking for an answer to this.

You could do this in .csproj file like this:

<ItemGroup>
<None Include="$(SolutionDir)FolderToCopy\**" CopyToOutputDirectory="Always"/>
</ItemGroup>
Related