错误“在Visual Studio中找不到元数据文件'... \ Release \ project.dll'". [英] Error "Metadata file '...\Release\project.dll' could not be found in Visual Studio"

查看:450
本文介绍了错误“在Visual Studio中找不到元数据文件'... \ Release \ project.dll'".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我开始随机收到此消息:

Recently I started to get this message randomly:

在Visual Studio中找不到元数据文件'... \ Release \ project.dll'

Metadata file '...\Release\project.dll' could not be found in Visual Studio

我有一个包含多个项目的解决方案.当前的构建模式为调试",所有项目的配置均设置为调试".但是,当我尝试运行主项目时-有时它会给我一些错误,所有错误都是找不到元数据文件'... \ Release \ projectX.dll'",而且,它说的是关于RELEASE的信息.文件夹,尽管当前模式是调试".为什么?我试图在所有解决方案文件中搜索对"Release \ projectX.dll"的引用,然后在ResolveAssemblyReference.cache文件中找到了一个引用.

I have a solution with several projects in it. The current build mode is Debug and all projects' configurations are set to Debug. But when I try to run the main project - sometimes it gives me a few errors, all of which are "Metadata file '...\Release\projectX.dll' could not be found" - and, look, it says about RELEASE folder, though current mode is Debug. Why? I tried to search for reference to "Release\projectX.dll" inside all solution files, and I found one in ResolveAssemblyReference.cache file.

我在Internet上进行了很好的搜索,发现了一些存在类似问题的人,但是没有解决方案,或者至少没有可行的解决方案.

I made a good search over the Internet and found a few people with a similar problem, but there was no solution, or at least no working solution.

我试图删除对这些项目的引用并阅读它们,但是一段时间后,我又开始再次遇到这些错误.

I tried to delete references to those projects and read them, but in some time I start getting these errors again.

似乎是个错误.当我始终使用调试模式时,为什么在发布"文件夹中搜索引用的项目?

It seems like a bug. Why does it search for referenced projects in Release folders when I always use Debug mode?

PS.对于遇到此问题的用户:我无法轻松解决.仅在我重新安装Windows后,它才消失了:(

PS. For those who met this problem: I couldn't solve it in an easy way. It disappeared only after I reinstalled Windows :(

推荐答案

好吧,我的答案不仅是所有解决方案的摘要,而且还提供了更多的解决方案.

第(1)节:

一般解决方案:

我遇到了4个此类错误(找不到元数据文件")以及1个错误,提示无法打开源文件(未指定错误").

I had 4 errors of this kind (‘metadata file could not be found’) along with 1 error saying 'Source File Could Not Be Opened (‘Unspecified error ‘)'.

我试图摆脱找不到元数据文件"错误.为此,我阅读了许多帖子,博客等,发现这些解决方案可能是有效的(在此处进行总结):

I tried to get rid of ‘metadata file could not be found’ error. For that, I read many posts, blogs etc and found these solutions may be effective (summarizing them over here):

  1. 重新启动VS,然后再次尝试构建.

  1. Restart VS and try building again.

转到解决方案资源管理器" .右键单击解决方案.转到属性.转到配置管理器" .检查是否已选中构建" 下的复选框.如果未选中任何一个或全部,请检查它们并尝试再次构建.

Go to 'Solution Explorer'. Right click on Solution. Go to Properties. Go to 'Configuration Manager'. Check if the checkboxes under 'Build' are checked or not. If any or all of them are unchecked, then check them and try building again.

如果上述解决方案不起作用,请按照上面第2步中提到的顺序进行操作,即使选中了所有复选框,也请取消选中它们,然后再次检查并尝试再次构建.

If the above solution(s) do not work, then follow sequence mentioned in step 2 above, and even if all the checkboxes are checked, uncheck them, check again and try to build again.

构建订单和项目依赖项:

转到解决方案资源管理器" .右键单击解决方案.转到项目依赖项..." .您将看到2个标签:依赖关系" 构建订单" .此构建顺序是解决方案的构建顺序.检查项目依赖性和构建顺序,以验证是否有依赖于其他项目(例如"project2")的某个项目(例如"project1")在该项目(project2)之前尝试构建.这可能是导致错误的原因.

Go to 'Solution Explorer'. Right click on Solution. Go to 'Project Dependencies...'. You will see 2 tabs: 'Dependencies' and 'Build Order'. This build order is the one in which solution builds. Check the project dependencies and the build order to verify if some project (say 'project1') which is dependent on other (say 'project2') is trying to build before that one (project2). This might be the cause for the error.

检查缺少的.dll的路径:

检查丢失的.dll的路径.如果路径中包含空格或其他任何无效的路径字符,请将其删除并尝试再次构建.

Check the path of the missing .dll. If the path contains space or any other invalid path character, remove it and try building again.

如果是原因,请调整构建顺序.

If this is the cause, then adjust the build order.

第(2)节:

我的特殊情况:

我尝试了上述所有步骤,并进行了各种排列和组合,并重新启动了VS几次.但是,它没有帮助我.

I tried all the steps above with various permutations and combinations with restarting VS few times. But, it did not help me.

因此,我决定摆脱遇到的其他错误(无法打开源文件(未指定错误")").

So, I decided to get rid of other error I was coming across ('Source File Could Not Be Opened (‘Unspecified error ‘)').

我遇到了一个博客: http://www.anujvarma.com/tfs -errorsource-file-not-of-opened-unspecified-error/#comment-1539

I came across a blog: http://www.anujvarma.com/tfs-errorsource-file-could-not-be-opened-unspecified-error/#comment-1539

我尝试了该博客中提到的步骤,并且摆脱了错误无法打开源文件('Unspecified error')',令人惊讶的是,我摆脱了其他错误 (找不到元数据文件").

I tried the steps mentioned in that blog and I got rid of the error 'Source File Could Not Be Opened (‘Unspecified error ‘)' and surprisingly I got rid of other errors (‘metadata file could not be found’) as well.

第(3)节

故事的寓意

尝试使用上面第(1)节中提到的所有解决方案(以及任何其他解决方案)以消除错误.如果无法解决问题,请按照上面第(2)节中提到的博客, 从.csproj文件中删除不再存在于源代码管理和文件系统中的所有源文件的条目 .

Try all solutions as mentioned in section (1) above (and any other solutions) for getting rid of the error. If nothing works out, as per the blog mentioned in section (2) above, delete the entries of all source files which are no longer present in the source control and the file system from your .csproj file.

这篇关于错误“在Visual Studio中找不到元数据文件'... \ Release \ project.dll'".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆