Metadata file '.dll' could not be found

2019-01-03 07:34发布

I am working on a WPF, C# 3.0 project, and I get this error:

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

This is how I reference my usercontrols:

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

It happens after every failed build. The only way I can get the solution to compile is to comment out all my user controls and re-build the project, and then I uncomment the usercontrols and everything is fine.

I have checked build orders and dependencies configurations.

As you can see, it seems to have truncated the DLL file's absolute path... I have read that there is a bug with the length. Is this a possible problem?

It's very annoying and having to comment, build, and uncomment, the build is becoming extremely tiresome.

30条回答
一夜七次
2楼-- · 2019-01-03 07:53

In my case it was caused by a .NET Framework version mismatch.

One project was 3.5 and the other referencing project 4.6.1.

查看更多
我想做一个坏孩纸
3楼-- · 2019-01-03 07:56

I'd faced the same problem. In my case I'd referenced to a class library project with higher .Net version than my project and VS failed to build the project and raised the same error you posted.

I simply set .Net version of my class library project(the one that had broken the build) identical to the .Net version of referenced project and problem solved.

查看更多
【Aperson】
4楼-- · 2019-01-03 07:56

I had this error when I was trying to publish a web application. Turned out that one of a class properties was wrapped into

#if DEBUG
    public int SomeProperty { get; set; }
#endif

but the property usage was not. The publishing was done in Release configuration without the DEBUG symbol, obviously.

查看更多
做个烂人
5楼-- · 2019-01-03 07:57

I am running Visual Studio 2013.

It appears that the build dependencies were incorrect. Deleting the *.suo files did fix the problems I had.

查看更多
Animai°情兽
6楼-- · 2019-01-03 07:57

For my case it was that I had commented out classes in a specific (empty) namespace:

namespace X.Y.Z.W
{

    // Class code

}

When I removed the namespace code and the import (using) commands of it - it fixed the problem.

In the build it was also saying - along with the missing DLL file of the project:

error CS0234: The type or namespace name 'W' does not exist in the namespace 'X.Y.Z' (are you missing an assembly reference?)

查看更多
萌系小妹纸
7楼-- · 2019-01-03 07:57

In my case the issue was that I'd manually deleted a non-compilation file which was marked as "missing". Once I deleted the reference to the now-missing file and recompiled - all was well.

查看更多
登录 后发表回答