Wednesday, March 16, 2011

Turn on Compile-time View Checking for ASP.NET MVC Projects

You can make the web project perform compile time checking of the markup in the views by modifying the .csproj file and turning on the "MvcBuildViews" property. The advantage of this is that you will know at compile time any problem with a view, not at run time when someone accesses that page. So please follow the below blog to do that: However, doing in this will make the compilation is extremely slower. It made me crazy every time I want to debug a unit test because it build the solution include the views and It could take 1 minutes before starting the test debug. To overcome that, I turn off MvcBuildViews for Debug compilation of the solution. To do this, open the web .csproj file by any text editor, find <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> then add <MvcBuildViews>false</MvcBuildViews> under it. It will simply overwrite the default setting which was set to true for DEBUG configuration.

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">


niku said...

hi, a. Hiện em đang tìm hiểu về mvc, e chỉ có thể triên khai sản phẩm với iis 6 và server 2003. Thắc mắc của em là: 1. mvc có hạn chế gì trên iis 6 k? 2. Giải pháp triển khai tốt nhất hiện nay là đối với mvc và giới hạn nên tảng của e(có tận dụng được framwok mvc của ms k hay là tự tạo). Đề nghị anh viết một bài về chủ đề này được k? thank anh nhiều.

vantheshark said...

There are not any limitations with ASP.NET MVC on II6 and Server 2003. If you're interested in MVC, I believe there are a lot of articles, blogs about it. Current version of ASP.NET MVC is 3 and it's a very hot framework in .NET Community although before it, there are several open source MVC frameworks for .NET. Therefore, my suggestion is do not reinvent the wheel :).

Good luck.

niku said...

ok, thank you very much.

Post a Comment