Edit and Continue in ASP.NET MVC 3 application

这一生的挚爱 提交于 2019-11-28 07:45:15
MemeDeveloper

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 !

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.

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