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,

Published Saturday, March 28, 2009 12:04 AM by chanva
Filed under: , ,

Comments

# ASP.NET MVC Archived Blog Posts, Page 1

Sunday, March 29, 2009 10:28 PM by ASP.NET MVC Archived Blog Posts, Page 1

Pingback from  ASP.NET MVC Archived Blog Posts, Page 1

# re: Find out code errors in the ASP.NET views by Precompilation

Tuesday, April 14, 2009 2:27 AM by kathir

'gridview1_rowdatabound' is not a member of 'ASP.default2_aspx'

Leave a Comment

(required) 
(required) 
(optional)
(required)