I\'m using Asp.net Mvc and I wanted to know why I don\'t need to compile my project when updating .net code in cshtml files? Now if we are talking about html\\css updates then I
Part of the ASP.NET infrastructure is the ASP.NET compiler. It is responsible for compiling declarative resources (*.aspx, *.ascx, *.cshtml etc.) into executable code.
There is no magic, the runtime decides when to run the compiler (e.g. when the resource has been changed since last run) and then invokes the compiler to create an imperative code out of the declarative code (e.g. an *.aspx is compiled into *.cs). Then it invokes regular language compiler to get a *.dll containing CIL.
This takes some time for the first time a resource is accessed, it could be handy to precompile all declarative resources ahead of time.
Overview:
http://msdn.microsoft.com/en-us/library/vstudio/ms178466(v=vs.100).aspx
Precompilation:
http://msdn.microsoft.com/en-us/library/aa983464(v=vs.110).aspx
.cshtml
files will be compiled just-in-time, that is when a request arrives regarding those pages.
However controllers are pre-compiled and stored into your project's DLL files.
Deciding which one to use, depends on your needs. Pre-compiling gives you less response time (because you've compiled the code before) but just-in-time compiling offers you flexibility.