Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Although Enable Edit and Continue is checked on the Web tab of my ASP.Net MVC 2 project, I cannot in fact change the source code while running. For example, if I try to edit a controller while paused in the debugger, I cannot change the file (acts as if read only).

I found a related post Edit and continue in ASP.NET web projects, however

  • The answers seem to suggest I should be able to at least edit the code, then reload the page to see the result.
  • I don't know what the distinction is between a Web Application and Web Site projects
like image 978
Eric J. Avatar asked May 28 '10 06:05

Eric J.


People also ask

How do I enable Debugging in Visual Studio?

To set Visual Studio debugger options, select Tools > Options, and under Debugging select or deselect the boxes next to the General options. You can restore all default settings with Tools > Import and Export Settings > Reset all settings.

How do I debug IIS Express?

To start debugging, select IIS Express (<Browser name>) or Local IIS (<Browser name>) in the toolbar, select Start Debugging from the Debug menu, or press F5. The debugger pauses at the breakpoints. If the debugger can't hit the breakpoints, see Troubleshoot debugging.


2 Answers

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.
like image 168
Darin Dimitrov Avatar answered Oct 21 '22 23:10

Darin Dimitrov


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.

like image 25
Md Nazmoon Noor Avatar answered Oct 21 '22 23:10

Md Nazmoon Noor