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

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


当前回答

在我的例子中,这些错误是由NuGet包管理器中的一些损坏引起的。解决方案的子项目没有得到构建,但是由于元数据错误,没有显示任何错误。

一旦所有的NuGet包都得到了纠正,项目就可以再次正确地构建了。

其他回答

我在对具有纯内容项目的MonoGame解决方案进行干净的CLI重建时遇到了这个问题。

解决方案是向每个内容项目添加一个带有空构造函数的虚拟类文件。

使用Blazor WebAssembly ASP。NET Core托管应用程序,当我删除天气预报模型时出现了这个问题,这导致了一个构建错误,不可见的错误。

如果是这种情况,只需删除FetchData。剃刀锉,你就可以出发了!

在对解决方案进行了大量更改之后,我开始遇到这个问题,搁置更改并撤销它。

解决这个问题的唯一方法是删除并再次添加从TFS到我的本地文件夹的映射。

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.

我在Visual Studio 2012中有很多项目的解决方案中遇到了这个问题。以与项目构建顺序相同的顺序手动重新构建解决方案中的每个项目(在解决方案资源管理器中右键单击并重新构建)为我修复了它。

最终我找到了一个给我一个编译错误的程序。我修复了错误,解决方案将在此之后正确构建。