Certain Razor views not publishing
As far as I'm aware, there are only 2 things that can cause this to happen.
- As you say in the question, the build action for each view needs to be set to "Content"
The view files need to be included in the project file, so in the
.csproj
file there should be a line like this:<Content Include="Views\ControllerName\Index.cshtml" />
Another one would be to set this in your csproje file. This was missing in mine, which caused it to make a precompiledviews.dll
in my publish:
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
Set it to false
explicitely in order to publish .cshtml files.