Search code examples
c#.netvisual-studio.net-core

How to add a folder in deployment in .NET Core?


I am trying to add an entire folder in the publication files, I have found several configurations but none of them work for me, for example

ASP.NET Core: Exclude or include files on publish

But it does not work for me, the folder I want to add is in the root of my project.

enter image description here

And I want to see it in the publication archives in this way

enter image description here

I have tried to add the folder to the publication in this way

enter image description here

I am using .NET CORE 2.1 and Visual Studio 15.7.5

What am I doing wrong?


Solution

  • Assuming the files are located in or below the wwwroot folder, just set the Build Action to Content (for each file) and it will get copied when publishing.

    (My project only uses files below wwwroot, so I can't comment on a different folder.)

    There is no need to manually edit the csproj.