---
title: "Compile Views in ASP.NET MVC"  
description: "Compile Views in ASP.NET MVC"  
author: "Anonymous User"  
published: 2015-01-02  
updated: 2015-01-02  
canonical: https://www.mindstick.com/forum/12838/compile-views-in-asp-dot-net-mvc  
category: ".net"  
tags: ["asp.net", "asp.net mvc"]  
reading_time: 1 minute  

---

# Compile Views in ASP.NET MVC

I want an msbuild [task](https://www.mindstick.com/forum/161761/what-is-the-difference-between-task-and-thread) to [compile](https://www.mindstick.com/forum/2316/how-to-views-compile-in-mvc) the [views](https://www.mindstick.com/forum/34068/what-is-use-of-validateantiforgerytoken-in-asp-dot-net-mvc-views) so I can see if there are compile time [errors](https://answers.mindstick.com/qa/116170/fresh-fir-against-gandhis-in-national-herald-case-cover-up-for-ed-s-own-errors) at well... compile time. Any [ideas](https://www.mindstick.com/articles/43878/making-the-best-use-of-the-options-trade-ideas)?

## Replies

### Reply by Anurag Sharma

I frankly would recommend the RazorGenerator nuget package. That way your views have a .designer.cs file generated when you save them and on top of getting compile time errors for you views, they are also precompiled into the assembly (= faster warmup) and Resharper provides some additional help as well.

To use this include the RazorGenerator nuget package in you ASP.NET MVC project and install the "Razor Generator" extension under item under Tools -> Extensions and Updates

We use this and the overhead per compile with this approach is much less. On top of this I would probably recommend .NET Demon by RedGate which further reduces compile time impact substantially.

Hope this helps.


---

Original Source: https://www.mindstick.com/forum/12838/compile-views-in-asp-dot-net-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
