在 ASP.NET MVC 3 应用程序中编辑并继续
是否可以使用 Visual Studio 2010 在 ASP.NET MVC 3 应用程序中编辑并继续?如果是这样,我该怎么做?
顺便说一句,我的操作系统平台是x86。
编辑:当我按 f5 然后尝试编辑代码时,我收到以下错误:代码运行时不允许更改,或者禁用“一个进程中断时中断所有进程”选项。可以在“工具”、“选项”、“调试”中启用该选项。
即使启用了该选项,我也无法在代码运行时编辑代码。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
经过大量的混乱、谷歌搜索和(本质上)猜测工作,(我实际上运行的是 x64 环境),我发现以下启用了 MVC 3 编辑并继续对我来说太棒了!
(项目属性 > Web 选项卡)
框架,第三版
现在我可以设置一个断点,然后按 F5,然后当断点命中时 - 我可以更改我的代码(例如,在 MVC Web 应用程序引用的控制器或类库项目中),然后继续调试(再次按 F5)并且更改被采纳,一切似乎都按预期进行!
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 !
(project properties > Web tab)
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 !
除此之外,您会发现“编辑并继续”不适用于某些方法 - 具有动态类型变量的方法和具有 lambda 表达式的方法。如果您使用 LINQ to(任何东西)从存储库检索数据,您可能会使用大量 lambda,当然 ViewBag 是 MVC 应用程序中的常见动态。
因此,“编辑并继续”和 MVC 混合得不好。实际上,这没什么问题,因为它让您养成测试驱动开发的习惯——编写好的测试,编写通过测试的代码,然后才构建和运行。
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.