3

我们在 32 位操作系统的 Windows 7 上使用 VS 2012。

我已从工具 -> 选项 -> 调试 -> 编辑并继续启用“编辑并继续”功能。

我仍然无法在调试模式下编辑 .cs 文件。

有人可以建议我缺少什么吗?

我将断点保留在 mvc 控制器类之一中。当它到达断点时,我尝试编辑并收到以下消息:

Changes are not allowed in the following cases:

  -When the debugger has been attached to an already running process
  -The code being debugged was optimized at build or run time.
  -The assembly being debugged is loaded as domain-neutral.
  -The assembly being debugged was loaded through reflection.
  -When Intellitrace events and call information is enabled.
4

2 回答 2

8

Just to clarify some bits as it might help others..

1) The answer from [Gupta Anirudha F1beta] is correct

These below applies for Visual Studio 2012, 2013 + MVC 4, I was trying to edit Controller

2) If Edit & Continue is disabled, you cannot make changes in the *.cs code, you will see the message as [mmssaann] highlighted above. To edit your code, you need to stop debugging, edit your code and start debugging again to continue

3) If Edit & Continue is enabled, you can make changes in the *.cs code, BUT you will get a different message after you continue debugging saying Edit or Restart (so the website will be recompiled again). This approach is same as above but it seems a bit faster maybe you save like 1 click which makes in 50 years of coding like thousands of saved clicks :-)

I hope this helped :)

于 2013-07-29T16:19:25.467 回答
4

Web应用程序需要在执行时动态编译网站时进行编译。

编辑和继续在 MVC 类型的项目中不起作用。您需要设置断点并编译整个项目来调试您的项目。

于 2013-07-16T03:31:26.570 回答