开发者

Folder not uploading with VS Publish / Web Deploy

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

However it d开发者_开发技巧oes not by default publish my "files" folder that I have highlighted below.

Folder not uploading with VS Publish / Web Deploy

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

Thanks Paul


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.


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"

Folder not uploading with VS Publish / Web Deploy


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.


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".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜