Edit and Continue does not Work in VS 2010 / ASP.Net MVC 2

本秂侑毒 提交于 2019-12-01 02:59:08

The distinction is that a Web Application needs to be compiled while a Web Site is compiled dynamically when executed (even the code behind).

As ASP.NET MVC uses a web application every time you make a change you need to recompile it and recompiling requires leaving the Debug mode. Indeed you could modify views and partials without the need of recompiling but for controller logic you always need to recompile.

To speed things up I would recommend you the following:

  1. When working with views and partials (i.e. doing some design stuff) run the application with Ctrl+F5 instead of F5 which will simply start the application in normal mode and your changes will be automatically picked up when you refresh the browser
  2. When working with code behind you should have a corresponding unit test that will allow you to quickly check the behavior. In this case running in Debug mode might be more useful as you might require checking values.

With Mvc you can't edit and continue. But if you run the project by IISExpress, then without running the project in debug mode you can edit the codebehind, rebuild the project. And then refreshing the pages in browser would work.

Further to @Darin's answer I'd have to say I don't like the idea of being able to change code whilst running.

I think we should be disciplined enough to write a test that reflects the expected outcome, write the code and then test live.

Having said that though, the way I get around that is to start the application in a browser w/out running, making my changes, compiling and then refreshing the browser.

Of course then I don't have the benefit of stepping through code but I can attach to the worker process at any time I need to.

Upgrade to VS2012. This does support Edit and Continue for ASP.Net projects (from the Web tab in the project properties window). Although it doesn't appear to be enabled by default!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!