Why am I forced to rebuild my project to see changes made to controllers in ASP.NET MVC?
I'm using ASP.NET MVC 3 Beta and for some strange reason, if I change a controller's action and load the action in a browser, it doesn't recompile the assembly to incorporate the changes made. Maybe I'm spoilt from how things were in ASP.NET Webforms, where there was dynamic on-the-flycompilation of code-behind files, but I think this s开发者_如何学Gohould be possible.
I'm left wondering if maybe it's due to how my project is set up. I'm using VS2010 and compiling for 64-bit executables.
In an ASP.NET WebForms Web Site Project, code-behind files were compiled on the fly.
In an ASP.NET MVC Web Application, the Controllers are pre-compiled assemblies which is why you need to build them each time a change is made. This is similar to how things worked in a pre-compiled ASP.NET WebForms Web Application.
You're not missing anything either. If you want .NET MVC, you'll have to live with compiling each time a change is made.
For me, this is a lot nicer. The utility of deploying a .dll as opposed to a ton of C# source files outweighs the convenience of on the fly compilation. That, and you can't accidentally deploy C# code which doesn't compile this way either.
Nope, there's no magic here. You will have to live with compiling things manually :)
精彩评论