By default, Visual Studio only checks for build errors on CSHTML files if they are open when you build. I want to make that happen at build for closed CSHTML files as well.
I have seen in this post: How to compile cshtml before runtime or this post
The solution was simple, just to set this in the csproj file:
<MvcBuildViews>true</MvcBuildViews>
Unfortunately this starts raising errors in cs files that it generates in temp folders. The cs files are the converted cs html files, and by themselves are not compile-able, hence I get a variety of build errors that don't actually exist.
My current solution is that I keep the MvcBuildViews setting false, and then manually open all the CSHTML files in the project before building.
Is there a fix for skipping the temp files, or a more efficient way than opening all the CSHTML files?