我在一个WPF, c# 3.0项目上工作,我得到了这个错误:

Error 1 Metadata file
'WORK=- \Tools\VersionManagementSystem\BusinessLogicLayer\bin\Debug
\BusinessLogicLayer.dll' could not be found C:\-=WORK=- \Tools
\VersionManagementSystem\VersionManagementSystem\CSC VersionManagementSystem

这是我如何引用我的usercontrols:

xmlns:vms="clr-namespace:VersionManagementSystem"
<vms:SignOffProjectListing Margin="5"/>

每次构建失败后都会发生这种情况。我能得到解决方案编译的唯一方法是注释掉所有用户控件并重新构建项目,然后取消注释用户控件,一切正常。

我已经检查了构建顺序和依赖项配置。

正如你所看到的,它似乎截断了DLL文件的绝对路径…我读到过关于长度的问题。这是一个可能的问题吗?

注释、构建和取消注释是非常烦人的,构建变得非常烦人。


当前回答

到目前为止,这几十个答案中没有一个对我有用。在我的情况下,我也得到了错误:

元组元素名称“Value”被推断出来。请使用语言版本7.1或更高的版本通过推断的名称访问元素

这出现在构建时“元数据文件'.dll'找不到”错误旁边,但它很快就消失了,因为错误有时会在IDE“赶上”。

双击错误以找到它,并删除有问题的代码,修复它。

否则,你可以在Visual Studio中试试这个:

菜单项目→<项目名称>属性→构建→按钮高级→语言版本→c# <最新小版本>(例如:“c# 5.0”)

这也能解决问题。

看起来“元数据文件“.dll”无法找到”通常是一些其他潜在问题的症状,因此,如果没有一个顶级解决方案对您有效,请检查其他错误和警告,并尝试找到真正的问题。

其他回答

六年后,在升级到Visual Studio 2015时,又遇到了同样的问题。因为这个特解不在我加进去的这个列表里。

c:\windows\system32…文件夹中。 将它们移动到一个非系统文件夹,并添加一个对新文件夹的引用,最终解决了这个问题。其余的问题确实是其他人已经在这里说过的

我正在运行Visual Studio 2013。

似乎构建依赖项是不正确的。删除“*”。suo文件确实解决了我遇到的问题。

The Visual Studio IDE doesn't do any building behind the scenes, the Msbuild application does. The VS IDE essentially just constructs the project file that is used by Msbuild and quite often it makes mistakes if you leave it up to the IDE to figure things out on it's own. If you are getting the Metadata file '.dll' could not be found error it is likely due to the fact that the correct/expected assemblies are not being found. So perhaps Visual Studio might be creating a project file for a 4.5 framework app, and expecting 4,5 assemblies, while you are referencing 4.0 assemblies. So look at your Visual Studio settings for incompatibilities or go into the project file yourself, and manually fix it by specifying the correct path <Reference Include="C:\\correct path to assembly\\yourAssembly.dll" />.

我在打开一个实体框架被引用的项目后收到了这个错误,所以我删除了这些引用,并通过pthe socket管理器重新安装了实体框架6.0.0.0版本:

install-package entityframework -version 6.0.0.0

错误仍然在显示,所以我认为那些引用在那里,因为有一个旧版本的实体框架应该“预安装”在项目中,但它并没有真正工作。

所以我去找文件包。Config,并注意到有另一个引用:

<packages>
  **<package id="EntityFramework" version="5.0.0" targetFramework="net45" />**
  <package id="EntityFramework" version="6.0.0" targetFramework="net45" />
</packages>

然后我删除了这一行,清理并重新构建了项目和容器解决方案,它最终工作了。

此问题可能是由于代码中的语法错误而发生的,由于元数据错误,您可能无法看到该语法错误。因此,在执行前面回答中的任何操作之前,请检查您的源文件。