Visual Studio - 出现错误“找不到元数据文件‘XYZ’"编辑后继续 [英] Visual studio - getting error "Metadata file 'XYZ' could not be found" after edit continue
问题描述
我偶然发现了一个非常烦人的问题.
当我调试我的软件时,一切运行正常,但是如果我遇到断点并编辑代码,当我尝试继续运行时,我会收到一个错误:找不到元数据文件XYZ"
I have stumbled into an issue that is really annoying.
When I debug my software, everything runs OK, but if I hit a breakpoint and edit the code, when I try to continue running I get an error:
Metadata file 'XYZ' could not be found
看了一圈,发现了一些类似问题,但它们都与构建失败有关,这不是我的情况(这仅在编辑继续后发生).
After looking around for a while, I found some a similar issues, but they were all regarding a build failure, which is not my case (this happens only after edit-continue).
到目前为止我尝试过的:
- 我的代码正在编译和运行.
- 我清理了解决方案并重新启动了 VS.
- 我确保正在为我正在运行的配置(在配置管理器中)构建丢失文件的项目.
- 我手动构建了丢失文件的项目.
一些额外信息:
- 不管我更改了什么,仍然出现相同的错误(更改与丢失的文件无关).
- 当我暂停和继续时也会发生这种情况(不仅是断点)
- 我正在使用自定义配置(配置管理器...)运行项目.当我使用默认的
Debug
配置运行它时,不会发生错误.
- It does not matter what I change, still get the same error (the change is not related to the missing file).
- This happens also when I pause and continue (not only breakpoints)
- I am running the project using a custom configuration (configuration manager...). When I run it using the default
Debug
configuration the error does not occur.
有什么想法吗?
推荐答案
最终解决问题的是:
- 单独清理每个项目(右键单击>清理).
- 单独重建每个项目(右键单击重建).
- 重建启动项目.
我猜出于某种原因,仅仅清洁解决方案与单独清洁每个项目的效果不同.
I guess for some reason, just cleaning the solution had a different effect than specifically cleaning every project individually.
根据@maplemale 评论,似乎有时还需要删除和重新添加每个引用.
As per @maplemale comment, It seems that sometimes removing and re-adding each reference is also required.
2019 年更新:
这个问题以前流量挺大的,不过好像自从VS 2017发布之后,关注度就少了很多.
因此,另一个建议是 - 更新到较新版本的 VS(>= 2017)以及其他新功能,此问题也将得到解决
Update 2019:
This question got a lot of traffic in the past, but it seems that since VS 2017 was released, it got much less attention.
So another suggestion would be - Update to a newer version of VS (>= 2017) and among other new features this issue will also be solved
这篇关于Visual Studio - 出现错误“找不到元数据文件‘XYZ’"编辑后继续的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!