Find out code errors in the ASP.NET views by Precompilation
When developing ASP.NET website based on ASP.NET MVC, we would write plenty of codes in the ASP.NET views. We always encounter a kind of problems that the code errors in the views cannot be found out when building the website, the error will be thrown until we open the view. I think it is too late. The solution is that we can utilize precompiling an ASP.NET Web site to find out errors in the ASP.NET views immediately.
You could put the following command into the Post-build event textbox of the Project Properties window.
-
D:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler -p "$(ProjectDir)." -v /$(ProjectName)
If you feel it is a little slow, you could put the command like below into a batch file, then you execute it just as you need.
-
D:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler -p "e:\MvcApplication1" -v /$MvcApplication1
Hope this helps,