在Visual Studio中调试时,有时我添加了一个断点,但它是空心的,VS说“断点目前不会被击中。”源代码与原始版本不同。”显然,这使我无法进行调试。
这条消息到底是什么意思?什么原始版本?如果我只是打开了解决方案,而没有对代码做任何更改,又怎么会有“原始版本”呢?
在Visual Studio中调试时,有时我添加了一个断点,但它是空心的,VS说“断点目前不会被击中。”源代码与原始版本不同。”显然,这使我无法进行调试。
这条消息到底是什么意思?什么原始版本?如果我只是打开了解决方案,而没有对代码做任何更改,又怎么会有“原始版本”呢?
当前回答
有一个几乎察觉不到的设定为我解决了这个问题。 如果有一个特定的源文件没有命中断点,则可以将其列在
解决方案资源管理器 右键单击解决方案 属性 公共属性 调试源文件 "不要找这些源文件"
出于某种我不知道的原因,VS 2013决定在那里放置一个源文件,随后,我无法在该文件中点击断点。这可能是“源代码与原始版本不同”的罪魁祸首。
其他回答
对我来说,那是在做一个网站项目的时候。在清理了这些临时文件夹后,我得到了正确的编译器错误:
C:\Documents and Settings\ %username%\AppData\Local\Temp\临时 ASP。网络文件 C: \ windows \ Microsoft.NET \ Framework \ v4.0.30319 \临时ASP。网 文件
我最终解决了这个问题,当我发现一个类文件,我故意移动到一个子文件夹,以某种方式重新出现在根文件夹。当我在编辑另一个的时候,VS用了那个。
This happen often also if you are using a file references to binaries (instead of project references to code in your project), and the compiled binary that you are referencing falls out of sync with the corresponding source code on your machine. This can happen because you downloaded a new version of the binary from source control without the new source code that went with it, or you have a few versions of the binary on your machine and are referencing an old copy, etc. If this is indeed the problem, it's a good reason to use project references as much as it practical.
我只是重新装填,清理和重建我的作品。
对我来说,没有一个项目能解决这个问题。我只是在函数中添加了一行新代码,类似于:
int a=0;
通过添加这个,我想我触发了visual studio在原始版本中添加这个功能
正如它所说,“源代码与原始版本不同”。
右键单击解决方案资源管理器中的项目文件夹,并选择Clean。构建项目的新版本,断点将再次工作!