Ease your web development - compile your Razor views!

Don't you just love when - as you add or modify the service layer and models of your web code - everything just works? That is, until you hit that (partial) view that you were not expecting to be affected by your change and ...

BOOM!

It is extra amounts of fun, when this page is at the end of a page flow, having required that you enter a lot of data before hitting the brick wall.

I found it tremendously helpful to enable Build Views in my solutions for this reason. By enabling this single feature, whenever you build your web project, your views get built too, ensuring that silly things like typos doesn't cramp your style:







To enable the feature, simply right-click your web project and unload it. Then, right-click it again and choose to edit it. Locate the tag MvcBuildViews and change it to serenity:


<mvcbuildviews>true</mvcbuildviews>

After this single change, save your project file, right click on it in Solution Explorer and choose to reload it. As you rebuild your project, your views are no longer trying to hide things from you.

Good times!

Comments

Popular posts from this blog

Auto Mapper and Record Types - will they blend?

Unit testing your Azure functions - part 2: Queues and Blobs

Testing WCF services with user credentials and binary endpoints