简体   繁体   English

找不到Visual Studio 2017元数据文件EntityFramework.dll

[英]Visual Studio 2017 Metadata file EntityFramework.dll could not be found

I am working on a C# program that utilizes EntityFramework, I've cloned the program from git repo, but now it is having that dreadful Metadata file 'EntityFramework.dll' could not be found error. 我正在开发一个利用EntityFramework的C#程序,我已经从git repo克隆了程序,但是现在它Metadata file 'EntityFramework.dll' could not be found那个可怕的Metadata file 'EntityFramework.dll' could not be found错误。 I have searched and tried countless suggestions for this kind of problem, but none worked. 我已经搜索并尝试过无数针对这类问题的建议,但都没有成功。 I've already checked that the reference to EntityFramework.dll in the .csproj files are correct and it is definitely there under the packages\\EntityFramework.6.2.0\\lib\\net45\\ folder. 我已经检查过.csproj文件中对EntityFramework.dll的引用是正确的,它肯定存在于packages\\EntityFramework.6.2.0\\lib\\net45\\文件夹下。 So I am not sure what else to try. 所以我不确定还有什么可以尝试的。

请看看bin文件夹,有时那里不存在dll。

In Visual Studio, on top, click on Build -> Configuration Manager. 在Visual Studio中,单击“构建” - >“配置管理器”。 Make sure that the build checkbox next to your project is checked. 确保选中项目旁边的构建复选框。 In case it already is, uncheck it and then make it checked again. 如果它已经是,取消选中它然后再次检查。 Clean your Solution and Build it again after this. 在此之后清洁您的解决方案并再次构建它。

This typically happens when teams check in files that should not be checked in (such as the .suo file) or have "optimized" their builds to exclude rarely changed projects. 这通常发生在团队签入不应签入的文件(例如.suo文件)或“优化”其构建以排除很少更改的项目时。 (unticking projects in the configuration manager.) (在配置管理器中解开项目。)

Another common cause for missing references is when devs reference a dependency from a /bin folder instead of the packages folder, but it sounds like you've confirmed that isn't the case. 缺少引用的另一个常见原因是devs从/ bin文件夹而不是packages文件夹引用依赖项,但听起来您已经确认不是这种情况。

Other questions such as Metadata file '.dll' could not be found list a number of things to check, so your problem will surely be one of these. 无法找到其他问题,例如元数据文件'.dll'列出了许多要检查的内容,因此您的问题肯定会是其中之一。 Try building each project individually, working from projects that have no project dependencies upwards to the main application project(s). 尝试单独构建每个项目,从没有项目依赖性的项目到主应用程序项目。 Ensure they're running the same .Net versions, check the solution NuGet packages for dependencies with "multiple versions" and consolidate these so that the solution is using a single version of each dependency. 确保它们运行相同的.Net版本,检查解决方案NuGet包的依赖性与“多个版本”并合并这些以使解决方案使用每个依赖项的单个版本。 (generally good for cleaning up) Also look at .config files for version re-directs that sometimes get zombified in source control. (通常适用于清理)另请查看.config文件以获取版本重定向,有时会在源代码管理中进行僵化。

Ok, I've resolved this problem. 好的,我已经解决了这个问题。 Here is what happened. 这是发生了什么。 Apparently, when cloning into local directory, one of the folder on the path has a space in its name (like My DSS ), and this nuget issue seems to indicate the inability of nuget to find package with space in path. 显然,当克隆到本地目录时,路径上的一个文件夹名称中有一个空格(如My DSS ),这个nuget问题似乎表明nuget无法在路径中找到包含空格的包。 So, once I changed that folder's name to MyDSS , it compiled successfully. 因此,一旦我将该文件夹的名称更改为MyDSS ,它就会成功编译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM