我在一个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文件的绝对路径…我读到过关于长度的问题。这是一个可能的问题吗?

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


当前回答

就我个人而言,我未能在解决方案中添加对其中一个项目的引用,这就是导致我出现错误的原因。

其他回答

在我的例子中,我以错误的方式获得了安装目录。

如果您的解决方案路径类似于“我的项目%2c非常流行%2c单元测试%2c软件和硬件。zip”,它不能解析元数据文件,也许我们应该防止一些无效的单词,如%2c。

当从某些站点克隆存储库时,目录名是URL编码的。它将把目录名中的空格字符转换为%20,正斜杠转换为%2f,下划线转换为%5f,等等。虽然,我不确定为什么%符号会破坏事情。

将路径重命名为正常名称解决了我的问题。

对我来说,这是错误的文件夹名称。如果从将空格替换为'%20'的源代码关闭,则会得到此类错误。 解决方案-重命名命名不当的文件夹。

以我为例,在注意到我引用了. net Framework 4.7项目作为. net Framework 4.6.1项目的依赖项后,我解决了这个问题。在将项目4.7迁移到4.6.1之后,我的应用程序正常编译

以上几点我都同意,只是有一点不同。 在我的例子中:我使用的是Visual Studio 2019。我结束了VS-2019,以VS-2017开始。并重建项目一切工作都很好! 我的职位日期是2019年4月19日

In my case it happened to me when I was referencing NuGet packages locally and moved their directory to somewhere else, I changed the path inside NuGet.Config but unfortunately I discovered that I should change the .csproject files manually to update the reference path, but the error message CS0006 was way far from describing this problem. Generally it also happens when there is a reference to DLL that couldn't be found, to be able to identify issue search your references in the project with the problem you will find some references with warning icon associated with them, try fixing those and it should work as expected.