My Visual Studio Ultimate 2013 Update 4 does not compile ASP.NET MVC 5 views.
Compilation errors are spotted on views sporadically, although compilation is always successful. Intellisense is also on and off on the views. I would say it was working significantly better in VS2012 (I did not much MVC on that version).
I have tried to add <MvcBuildViews>true</MvcBuildViews>
to the .csproj file, thing that uses to work in VS2010, but it is not working anymore.
Any idea what could be the problem?
UPDATE: I am looking for the way of seeing the errors on the view, as it was happening in previous versions of VS.
Right click your web project in the Solution Explorer. Click
Unload Project
. Right click the project and clickEdit <projname>.csproj
.Make sure you have this element (add it if it doesn't exist).
Scroll down to the bottom. You should see some comment "To modify your build process, add your task inside one of the targets below and uncomment it." Below that, add this markup:
(the above code should have a parent of the root
<Project>
node in case you don't see the comment I mentioned)Close the
.csproj
file, then right click your project in the Solution Explorer and clickReload Project
.This will add your views to the compilation step, and will stop your build if errors are found. I found this to be a good thing, because without it I sometimes don't notice errors in the Error List until I've deployed my site and then manually hit them. Be warned, it will add some time to your build step, significantly slowing it down. Depending on what you're trying to achieve, you may want to selectively enable/disable it to achieve a rapid build -> test workflow.
Inspiration for this answer was taken from Chris Hyne's answer to MVCBuildViews not working correctly and Can Razor views be compiled?.
Does your project include the target and hook into after build event? Try
msbuild WebApplication1.csproj /t:MvcBuildViews
from command line, it'll check that you have both default property set and target defined.Try creating a blank MVC project from within the VS2013U4 and compare the csproj to yours.