简体   繁体   中英

ASP.NET MVC 3 Strongly-typed Views: Why do compiler errors disappear/are ignored when a view is not open in VS editor?

Every time we make changes to a model we need to open all views using that model in VS editor and see if there are any errors before proceeding with a new deployment. Is there a way to enforce compiler errors in a strongly-typed view and prevent a project build so that no embarrassing errors ever appear on runtime? :-)

Thanks!

You can compile cshtml and aspx files at build time instead of runtime. To do this unload project, open it for edit, find <MvcBuildViews> tag and change value to true. If you have edmx files in your project clean solution before first edit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM