From the course: ASP.NET MVC: Building for Productivity and Maintainability
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Enabling view compilation to detect errors at build time
From the course: ASP.NET MVC: Building for Productivity and Maintainability
Enabling view compilation to detect errors at build time
- [Instructor] Perhaps the most straightforward and low risk tactic you could take to improve the quality of your ASP.NET MVC application is to tell Visual Studio to compile your views for you to help you find any coding errors at compile time instead of at run time. I'll start with a good example of how view compilation can help you find issues in your code before it's too late. Take a look at the product list you've shown here. Particularly the error that Visual Studio is highlighting on Line 17. This is a real bug in my application that Visual Studio's Intellisense is able to identify. However when I build my application this error is not included and the build is successful. Even though this bug exists in my view. That is because views are not included in the build by default. However ASP.NET MVC gives us a great feature to help us find these types of issues and include them with the rest of the compilation failures that Visual Studio reports. The problem is you won't find it in…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Enabling view compilation to detect errors at build time3m 15s
-
(Locked)
Reducing namespace references with global imports1m 58s
-
(Locked)
Customizing routes with attribute routing5m 10s
-
(Locked)
Reusing the same view for server-side and client-side rendering4m 48s
-
(Locked)
Better error logging with ELMAH5m 47s
-
(Locked)
Managing dependencies with dependency injection5m 53s
-
(Locked)
-
-
-
-
-
-