question

MGBhadurudeen-1345 avatar image
0 Votes"
MGBhadurudeen-1345 asked MGBhadurudeen-1345 edited

How to add a folder and its contents with build action content in to uwp project?

Hi, I have nearly 2000 files in my Assets\MyImages\ folder, which should be added as 'Build Action = Content'.
Now I am adding it manually in the properties window. I want to know is there any method to add all files and subfolders of a parent folder (MyImages) in to my project with Build action as content.

![119566-image.png][1]

 <Project...>
      ....
     <Content Include="Assets\MyImages\Animals\elephant1.png" />
     <Content Include="Assets\MyImages\Characters\Characters.txt" />
     <Content Include="Assets\MyImages\Flowers\Flowers.doc" />
     <Content Include="Assets\MyImages\Fruits\Fruits.some" />


I wish there must be a way to add it like, <Content Include="Assets\MyImages\*.*" /> through Notepad++
I tried this way. But no luck.

In short, I want to know how to add a folder with all its subfolders and all files in all subfolders with Build action as content by a single line in .csproj file?


windows-uwpvs-generalvs-msbuild
image.png (11.5 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Since your issue is more related to Visual Studio and MSbuild, I'll help you add the vs-msbuild tag so that engineers from the VS team could check your issue.

0 Votes 0 ·

1 Answer

TianyuSun-MSFT avatar image
0 Votes"
TianyuSun-MSFT answered MGBhadurudeen-1345 edited

Hi @MGBhadurudeen-1345 ,

Welcome to Microsoft Q&A forum.

Since Animals, Characters, Flowers, Fruits… are folders/subdirectories, you can try to use <Content Include="Assets\MyImages\**\*.*" />

Document about wildcards: Specify inputs with wildcards.

Best Regards,
Tianyu


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you! Concise and correct answer!

0 Votes 0 ·