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

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


当前回答

这适用于我在VS2019 . net Core, ASP。Net Core解决方案。

在解决方案的同一位置打开PowerShell控制台。 输入dotnet restore恢复所有包和项目 键入dotnet构建。解决方案将被构建

现在它也可以从Visual Studio IDE构建。 其他的解决方法对我都不起作用

其他回答

关闭和重新打开Visual Studio 2013对我来说很管用!

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" />.

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

我的项目也面临着同样的问题,我在一个解决方案中添加了控制台应用程序,但那些其他解决方案不起作用,并显示未找到.dll,所以我尝试了这个方法:

右键单击有问题的项目 单击应用程序选项卡,这是默认的 将输出类型控制台应用程序更改为类库

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

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