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

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


当前回答

在我的情况下,我有一堆其他的构建错误(一些简单的类型转换)以及这个,我抓着我的头试图解决这个问题,我没有关注其他错误。

最终解决我的问题的是,我修复了所有其他构建错误,然后我再次构建,它成功构建。

因此,如果您有其他构建错误以及丢失的DLL文件错误,并且没有其他方法为您工作,则尝试先修复其他错误,然后再次构建解决方案。

其他回答

在我的网页里。配置文件更改此

<?xml version="1.0" encoding="utf-8"?>

这个

<?xml version="1.0"?>

修正了我的问题

我的问题出现在我写c# 7代码时,但项目使用的是旧版本的。net框架

我的问题实例是由一个公共项目引起的,该项目中有重复的类名(在不同的文件名下)。奇怪的是,Visual Studio无法检测到这一点,而只是破坏了构建过程。

哇,看起来这个错误可能来自任何地方。

无论如何,我添加了一个新的WebAPI控制器到我的MVC应用程序,它自动魔术般地从NuGet得到所有的引用。后来我从NuGet UI中删除了引用,但我忘记删除使用它们的文件(即System.Http)。

出于某种原因,我收到的错误是这样的,以及一个关于未使用变量的简单警告。

我注释掉了变量,至少摆脱了警告,重新构建指出了所有使用不存在引用的文件。删除这些文件后,一切正常。

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.