Edit:
Here is a blog post on this topic as well:
How to Detect Errors of Our ASP.NET MVC Views on Compile Time
To make your views to be compiled, do the following;
- Unload your project by right
clicking the project on the solution
explorer in VS and clicking unload
project - right click the project which has
been converted to unavailable
project and click “Edit
your_project_name.csproj” (that
would be .vbproj if your
project is VB project) -
see the following code;
<!--There some lines of code here and I deleted them to get to the point quickly--> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <MvcBuildViews>false</MvcBuildViews>
-
change the MvcBuildViews tag value from
false
totrue
-
after that save it and reload your
project.
after you build your solution to compile it, you will see that your view will be compiled too.
NOTE: to test it, break some code in one of your view on purpose and try to build. you will see that you’ll get an error message.