Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Compile-Time Checking of ASP.NET Views

RSS
Modified on Fri, Jul 08, 2016, 1:14 PM by Administrator Categorized as ASP·NET MVC

Overview

If you've ever refactored a view model for an ASP.NET site, you're aware that doing so can break the Razor view(s) that the view model is based upon. Furthermore, you won't discover this until the view is invoked at run-time. This article describes how to avoid this by forcing the Razor views to be build at compile-time, thus revealing any issues.

Credits


Procedure

1. Unload Web project

2. Edit Web Project

3. Add the MvcBuildViews line

  <PropertyGroup>

    . . . 

    <MvcBuildViews>true</MvcBuildViews>

    . . . 

</PropertyGroup>

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.