Home > DeveloperSection > Forums > Compile Views in ASP.NET MVC
Monaj Singh
Monaj Singh

Total Post:41

Points:287
Posted on    January-02-2015 11:02 PM

 .NET ASP.Net  ASP.NET MVC 
Ratings:


 1 Reply(s)
 673  View(s)
Rate this:
I want an msbuild task to compile the views so I can see if there are compile time errors at well... compile time. Any ideas?


Anurag Sharma
Anurag Sharma

Total Post:40

Points:280
Posted on    January-02-2015 11:34 PM

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.


Don't want to miss updates? Please click the below button!

Follow MindStick