visual-studio 如何在 Visual Studio 的调试模式下启用文件编辑?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1105292/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 10:44:34  来源:igfitidea点击:

How do I enable file editing in Visual Studio's debug mode?

visual-studiovisual-studio-2008

提问by tom7

Is there a way to enable file editing while debugging in Visual Studio? I have unchecked the "Require the source file to exactly match the original version" checkbox. It makes no difference. I have to stop debugging to edit files. Very annoying. I enabled Edit and Continue. Same result. I disabled Edit and Continue - Same result.

有没有办法在 Visual Studio 中调试时启用文件编辑?我已取消选中“要求源文件与原始版本完全匹配”复选框。没有什么不同的。我必须停止调试才能编辑文件。很烦人。我启用了编辑并继续。结果一样。我禁用了编辑并继续 - 结果相同。

回答by Secko

As far as I know you can uncheck the "Edit and Continue" checkbox.

据我所知,您可以取消选中“编辑并继续”复选框。

Tools -> Options -> Debugging -> Edit and Continue > Enable Edit and Continue (uncheck)

工具 -> 选项 -> 调试 -> 编辑并继续 > 启用编辑并继续(取消选中)

回答by JaredPar

Expanding on Reed's correct answer.

扩展里德的正确答案。

When in debug mode editing a file is using a feature known as Edit and Continue (commonly abbreviated ENC). This allows users to change their program as it is running in the debugger.

在调试模式下编辑文件时使用称为“编辑并继续”(通常缩写为 ENC)的功能。这允许用户在调试器中运行时更改他们的程序。

When ENC is enabled, users are allowed to perform a limited set of edits on their file. The next action which continues execution of the program (F10, F5, etc ...) will cause the edits to be applied to the running program. If this succeeds the execution of the program will continue with the new code applied.

启用 ENC 后,用户可以对其文件执行一组有限的编辑。继续执行程序的下一个操作(F10、F5 等...)将使编辑应用于正在运行的程序。如果这成功,程序将继续执行并应用新代码。

The debugger does not allow edits to the file if ENC is not enabled.

如果未启用 ENC,调试器将不允许编辑文件。

There are a few reasons ENC may be disabled on your computer

ENC 在您的计算机上被禁用的原因有几个

  • Certain profiles do not enable ENC by default and it must be explicitly enabled
  • You may be running on a 64 bit OS and have your .Net app set to "Any CPU". ENC is not available on 64 bit(CLR limitation). You'll have to set the app back to x86 for ENC to work
  • 某些配置文件默认情况下不启用 ENC,必须明确启用
  • 您可能在 64 位操作系统上运行,并将您的 .Net 应用程序设置为“任何 CPU”。 ENC 在 64 位上不可用(CLR 限制)。您必须将应用程序设置回 x86 才能使 ENC 工作

回答by Francois Botha

  • UNcheck "Enable Edit and Continue" (Tools -> Options -> Debugging -> Edit and Continue > Enable Edit and Continue)
  • Build your app.
  • Run it.
  • Stop it.
  • REcheck "Enable Edit and Continue".
  • Build your app.
  • Run it.
  • Try editing the files while debugging now.
  • UN勾选“启用编辑并继续” ( Tools -> Options -> Debugging -> Edit and Continue > Enable Edit and Continue)
  • 构建您的应用程序。
  • 运行。
  • 停下来。
  • 重新选中“启用编辑并继续”。
  • 构建您的应用程序。
  • 运行。
  • 现在尝试在调试时编辑文件。

This worked for me. I believe it might be some bug or syncing issue with Visual Studio 2015.

这对我有用。我相信这可能是 Visual Studio 2015 的一些错误或同步问题。

回答by Reed Copsey

You need to enable Edit and Continue.

您需要启用Edit and Continue

回答by Dilaksha A

From MSDN

来自 MSDN

To enable/disable Edit and Continue

启用/禁用编辑并继续

  • Open debugging options page (Tools / Options / Debugging). Scroll

  • down to Edit and Continue category. To enable, select the Enable Edit

  • and Continue check box. To disable, clear the check box. Note. ...

  • Click OK.

  • 打开调试选项页面(工具/选项/调试)。滚动

  • 向下到“编辑并继续”类别。要启用,请选择启用编辑

  • 和继续复选框。要禁用,请清除复选框。笔记。...

  • 单击确定。

回答by Johannes Rudolph

usually editing a file during debugging is possible when you have hit a breakpoint (and only then).

通常,当您遇到断点(并且仅在那时)时,可以在调试期间编辑文件。

There are some restrictions though: -your new code must compile -you cant change code in a function that contains lambda expressions

但是有一些限制:-您的新代码必须编译-您不能更改包含 lambda 表达式的函数中的代码

回答by Muhammad Ashikuzzaman

For me this link Disabling IntelliTraceworked.
Go to

对我来说,这个禁用 IntelliTrace 的链接有效。

Tools > Options > IntelliTrace > (uncheck) Enable IntelliTrace

Or Debug > Options > IntelliTrace > (uncheck) Enable IntelliTrace

工具 > 选项 > IntelliTrace >(取消选中)启用 IntelliTrace

Debug > Options > IntelliTrace > (uncheck) Enable IntelliTrace

enter image description here

在此处输入图片说明

回答by Mark Vicuna

If you have Edit and Continue turned on and you are using C# you can only edit a file if the debugger has stopped either via a break point or you manually breaking into the App via "Break All". You still won't be able to edit some files, Ex. xaml files in a WPF app, but it should solve most problems.

如果您打开了“编辑并继续”并且您使用的是 C#,则只有在调试器已通过断点停止或您通过“全部中断”手动进入应用程序时,才能编辑文件。您仍然无法编辑某些文件,例如。WPF 应用程序中的 xaml 文件,但它应该可以解决大多数问题。

回答by Pranav Labhe

Removing tickat below option work for me

删除下面选项中的勾号对我有用

Tools > Option > Debugging > General > Enable Edit and Continue

工具 > 选项 > 调试 > 常规 > 启用编辑并继续

enter image description here

在此处输入图片说明

*Note: At some fellow developers system, Adding this tick performed the trick.

*注意:在一些开发人员系统中,添加此勾号执行了这个技巧。

回答by Prosun Chakraborty

I have tried this way and its Working for me. Go TO CSProj Or VbProj File -> Choose Asp.Net Development Server/ IIS Express ->Debuggers->Enable Edit and Continue->Save and Run.

我已经尝试过这种方式,它对我有用。转到 CSProj 或 VbProj 文件 -> 选择 Asp.Net Development Server/IIS Express ->Debuggers->Enable Edit and Continue->Save and Run。

enter image description here

在此处输入图片说明