Automatically Include all Files in folder in Visual Studio

Automatically Include all Files in folder in Visual Studio 

I’ve written before about how you have to make sure to include asset files into the project file if you want Azure to deploy them during a git deployment.

Thats pretty annoying, especially if you’re using external build tools to copy assets into the css, images or assets folders – You have to remember to right click and Include in Project.

Wouldn’t it be nice if Visual Studio and (therefore) msbuild just recursively included and deployed a folder of files?

You have to hand edit the .csproj file, but all you need to do is use a wildcard in the Include statement:

MyProject.Web.csproj
<!-- double wildcards include all files and folders -->
<Content Include="assets\**" />
<Content Include="images\**" />
<!-- You can also filter like you would at the command line -->
<Content Include="css\*.min.css" />

 

posted @ 2021-07-16 18:15  ChuckLu  阅读(44)  评论(0编辑  收藏  举报