Objective
MVC at compile time, will not prompt the view in the error, we publish the project will be a prompt exception, the project will be a big headache, because each release requires at least 5 minutes, and finally received only one exception information, if the page is too large, such as the recent collation of code modified many of the underlying code, It's very inefficient to find out how to use it in a published way.
Workaround
Reference URL: http://www.dotnetcurry.com/showarticle.aspx?ID=698
http://haacked.com/archive/2011/05/09/compiling-mvc-views-in-a-build-environment.aspx/
1. First right click on the project file and click on "Unload Project" option
2. Then right-click the project file again and tap the [edit] option
3. In the open page, locate <propertygroup condition= "' $ (Configuration) |$ (Platform) ' = = ' debug| AnyCPU ' > (each vs version node may be different)
Add the <MvcBuildViews>true</MvcBuildViews> property to the secondary node, and if you compile with debug, add it under the Debug node
4. Drag the page to the bottom and add the following to the last section </Project> front
<target name= "Mvcbuildviews" aftertargets= "Afterbuild" condition= "' $ (mvcbuildviews) ' = = ' true '" > < AspNetCompiler virtualpath= "Temp" physicalpath= "$ (webprojectoutputdir)"/></target>
5. Finally select the project file, right click Reload Project, click Save, you can
When compiling in MVC 4, let view also eject exception