Reputation: 195
I was adding a folder to my visual studio 2008 project, by dragging and dropping from explorer. I want to change the 'copy to output directory' property of the entire files in that folder to 'Copy Always'.
The problem is that the folder contains many subfolders, and so does the subfolders..so it was a little bit annoying not to be able to block all files and change the property in one step.
Is there a way to change the property of all the files in a folder containing many subfolders in one procedure?
Many Thanks...
Upvotes: 10
Views: 3973
Reputation: 71
Right click your Project, click "Edit project file" somewhere inside the < Project > add the following
<ItemGroup>
<Content Include=".\FOLDER\TO\ADD\**\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
Replace "\FOLDER\TO\ADD" with your actual folder that you want to be copied to your build output path
Upvotes: 1
Reputation: 49225
If you really have a lot of sub-folder & files then you can try these steps
//>/n
(slash & angled bracket followed by new line) with ">/n<CopyToOutputDirectory>Always<//CopyToOutputDirectory>/n<//Content>"
. (note that I use notepad++ and hence have escaped slashes). You can always leave out new lines if your tool doesn't support it. You may even try regex find & replace if your tool supports it.Include="
.Upvotes: 4
Reputation: 24759
Only way I know is to edit the csproj file. You could create a utility to help you do this.
A quick test i did yielded the following.
<Content Include="Test.css" />
After changing the properties...
<Content Include="Test.css">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Upvotes: 2
Reputation: 32377
Just expand all the folders. Select all the files at once, and change the Build Action to "Copy Always". You can select the top item, hold shift, select the last item and that will select all items.
Upvotes: 9