I have an ASP.NET 4.0 MVC 3.0 website which I have built and published into a directory on my machine ready to FTP to my hosting site. I have two .doc files which exist in a folder under the Content folder. When they were in their own folder, the folder was not included when published. I then included them in the Images folder under Content. When I publish, all the files in the Images folder are included except the two .doc files.
Why are the .doc files being ignored?
I took a closer look at this and I’m pretty sure it has to do with the build action of the files. If you add files such as Word docs and Excel docs to a project, Visual Studio does not include them with the publish by default. However, it will include image files and other similar content by default. To get the files to be included with the publish, right click on the document in Visual Studio and select Properties. Set the Build Action to “Content”, and you should be good to go.