0

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?

Berroterán
  • 131
  • 2
  • 12
  • *What am I doing wrong?* it's hard to tell unless you tell us what your doing? The question you linked seems to cover everything you need. I'm not sure what you want this question to add? – Liam Aug 08 '18 at 15:27
  • [When we ask a question about a problem with our code, we have to let the people who are helping us see it. Images of our code do not qualify.](http://idownvotedbecau.se/imageofcode) – Liam Aug 08 '18 at 15:31
  • I have edited the question adding the implementation I am doing – Berroterán Aug 08 '18 at 15:31
  • also, what type of applications is this? Console app, Class library, web page? Etc. – Liam Aug 08 '18 at 15:33
  • is an API with MVC – Berroterán Aug 08 '18 at 15:35
  • and where do you expect this folder to be when you publish it? – Liam Aug 09 '18 at 08:11

2 Answers2

1

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.

Neil
  • 11,059
  • 3
  • 31
  • 56
  • Very good observation, if I add it in wwwroot the folder is added in the publication, but my project is an API, then I do not want to leave the Queries folder there – Berroterán Aug 08 '18 at 15:59
0

If the folder/files is above the wwwroot folder, then right-click on the file and select "properties". In the properties window/pane, set "Copy to Output Directory" to "Copy Always" or "Copy if newer". This will post the folders and files in the right directory during the "Publish" process.