I'm wondering if there is a way to update a property for all images in my Visual Studio project?
I have multiple nested folders of images, and I'd like to change their 'Build Action' property from 'Resource' to 'Content'.
Currently I can only highlight and select/change all images in one folder. This is very time consuming when I have hundreds of folders and thousands of images.
I'm using Visual Studio 2013 Professional.
You can leverage wildcard in project file.
Add a item group
<ItemGroup> <Content Include="images/**/*.png"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> </ItemGroup>
Note **
is used to include folders recursively. It will include all png files under project file with BuildAction = Content.
After a bit more research, I found a way to edit the project file in the editor. Here are the steps I took to do this:
This was pretty quick and didn't require creating an additional project to do it programmatically.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.