9

Is it possible to Edit and Continue in ASP.NET MVC 3 app using Visual Studio 2010? If so, how can I do that?

btw, my OS platform is x86.

Edit: when I hit f5 and then try to edit the code I receive the following error: Changes are not allowed while code is running or if the option 'Break all processes when one process breaks' is disabled. The option can be enabled in Tools, Options, Debugging.

Even though the option is enabled I cannot edit my code when code is running.

Shaokan
  • 7,438
  • 15
  • 56
  • 80

2 Answers2

14

After a lot of messing about, googling, and (essentially) guess work, (I am actually running x64 environment) I found that the following enabled MVC 3 edit and continue for me Great !

  1. Setting all the projects to x86 in configuration manager
  2. Setting my WebApp project output path to "bin" in the properties window
  3. Setting my WebApp project to use Visual Studio Development Server (project properties > Web tab)
  4. following the 2 simple instructions from Pro ASP.NET MVC 3 Framework, Third Edition

Now I can set a break point, then hit F5, then when the break point hits - I can change my code (e.g. in controllers or class library projects referenced by the MVC web app), and continue debugging (F5 again) and the changes are picked up, and everything seems to be as it should !

Leniel Maccaferri
  • 100,159
  • 46
  • 371
  • 480
MemeDeveloper
  • 6,457
  • 2
  • 42
  • 58
  • For me point two did the trick. But I've no clue why the output path has to be "bin\". – Renato Heeb Apr 11 '12 at 07:34
  • did know... when I wrote it :) will check it out and see if cant remember. – MemeDeveloper Apr 12 '12 at 11:45
  • 4
    what are the 2 simple instructions in step 4? – zadam Feb 22 '13 at 01:15
  • 6
    The link to the "Two simple instructions" is dead. Why wouldn't you post that with your response? – jason Mar 13 '13 at 11:37
  • 4
    @jason ok - 1. In the edit and continue section of the debugging options (i.e. Tools > Options > Edit and Continue) tick the chb "Enable Edit and Continue" 2. In the Project Properties > Web tab tick the chb "Enable Edit and Continue" – MemeDeveloper Nov 18 '13 at 16:24
  • For me, "Project Properties > Web tab tick the chb 'Enable Edit and Continue'" did the trick. Thanks! You saved me! – leoly Mar 27 '14 at 02:17
  • 1
    Thankfully Visual Studio 2013 overcomes the x86 limitation, so Any CPU and x64 finally allow Edit and Continue – East of Nowhere Apr 03 '14 at 14:43
7

Further to this, you'll find that Edit and Continue will not work on certain methods -- those with dynamically-typed variables and those with lambda expressions. You'll probably have a lot of lambda if you're using LINQ to (anything) to retrieve data from repositories, and of course ViewBag is a common dynamic in MVC applications.

So, Edit and Continue and MVC mix poorly. Which is all right, really, because it gets you into the habit of test-driven development -- write good tests, code to pass the tests, and only then build and run.

Graham Charles
  • 9,394
  • 3
  • 26
  • 41
  • 4
    hmmm. I don't go in for TDD (shun the non believer charlie, shuuun shunnn). I'm a one man app machine and its not my cup of tea. Also.."LINQ to (anything)" is nothing necessarily to do with MVC. ViewBag point taken, but ... personally, whats the point of using the great MVC model, and the MVC.net model binding power if you mindlessly throw loads of stuff in the (dynamic - read not Strongly typed) ViewBag. Write (or better generate) a view model ??? No? – MemeDeveloper Apr 12 '12 at 11:47
  • 1
    @MemeDeveloper Ditto! when I work on private and small projects, TDD is a waste of time. Anyway EnC is awesome in vNext. – Shimmy Weitzhandler Apr 30 '15 at 21:16