Visual Studio 2010 Web Publish missing a file

2019-02-03 00:02发布

问题:

I'm finding that when publishing a website from Visual Studio its not uploading one of my files. Its a Razor file with a '.cshtml' extension (its doing the others!) and its part of the project.

Any ideas why it would exclude it?

回答1:

In Visual Studio, right-click on the file and go to Properties.

Under the file's properties, make sure that Build Action is set to Content. Otherwise it won't be published via web deploy.



回答2:

In my case I had a couple of config files that weren't being deployed even though they had "Build Action" set to Content. I fixed the problem by excluding them from the project and include them again



回答3:

I had the same issue. I tried to Exclude and re-Include the files. When that didn't work I checked my .proj file and the files were in fact missing. I had to add the files into the .proj file manually. That worked for me