Folder not uploading with VS Publish / Web Deploy

11.8k Views Asked by At

I am using the Publish / Web Deploy option within VS 2010 to publish my ASP.NET MVC3 website.

However it does not by default publish my "files" folder that I have highlighted below.

enter image description here

Any ideas how I can get this file included during publishing?

Thanks Paul

4

There are 4 best solutions below

2
On BEST ANSWER

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

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

0
On

In my case, the Error.txt file was not included in the Project and the Folder was not added during the Publish project.

I right-click the file name and click on "Include in Project" enter image description here

0
On

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

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

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

1
On

In my case I couldn't see the option to set files' Build Action to Content so I 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 click on file > Properties, the "Copy to Output Directory" is set to either "Always Copy" or "Copy When Newer".