[ACCEPTED]-Folder not uploading with VS Publish / Web Deploy-one-click-web-publishing

Accepted answer
Score: 29

Within the Visual Studio Solution Explorer 8 you need to right-click and select properties 7 on each of the files within that directory 6 (you can select them all at once and then 5 right-click -> properties if you want to 4 change them all).

Make sure the Build Action 3 is set to Content. This will ensure that 2 the files are copied as part of the publish 1 process.

Score: 2

enter image description hereIn my case, Error.txt file was not included in the Project and due to that Folder was 2 not adding during the Publish project.

I 1 just right click the file name and click at"Include in Project"

Score: 1

A probably less common case is when someone 9 (maybe yourself) added a <ExcludeFoldersFromDeployment>Content\files</ExcludeFoldersFromDeployment> line in the csproj 8 file, and then forgot about it, and later 7 you do want to publish the folder.

Because 6 of this line, none of the files in Content/files 5 (and subfolders) will be deployed, even 4 if the BuildAction is Content.

This is hard to spot 3 because, AFAIK, it is not visible anywhere 2 in visual studio, you have to open the csproj 1 file with a text editor.

Score: 1

In my case I couldn't see the option to 6 set files' Build Action to Content so I 5 had to:

  1. Right click on the folder > "Exclude From Project"
  2. Right click on the folder > "Include In Project"

Also, make sure that when you right 4 click on file > Properties, the "Copy 3 to Output Directory" is set to either 2 "Always Copy" or "Copy When 1 Newer".

More Related questions