led*_*per 11 entity-framework database-migration ef-code-first c#-4.0
这是我在收到此错误之前所做的事情:
这是错误:
Exception calling "CreateInstanceFrom" with "8" argument(s): "Could not load file or
assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicK
eyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest
definition does not match the assembly reference. (Exception from H
RESULT: 0x80131040)"
At C:\Projects\BCATracker.Web\packages\EntityFramework.6.0.0-
alpha2\tools\EntityFramework.psm1:425 char:31
+ $domain.CreateInstanceFrom <<<< (
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodTargetInvocation
Run Code Online (Sandbox Code Playgroud)
这是我尝试过的:
看看proj文件,我看到了这个:
<Reference Include="EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\EntityFramework.5.0.0\lib\net40\EntityFramework.dll</HintPath>
</Reference>
Run Code Online (Sandbox Code Playgroud)
可能的根本原因是什么?
all*_*en1 16
我解决了这个问题.EntityFramework.dll需要在GAC中供Visual Studio从包管理器中使用它.
注意:此时完全重新启动计算机可能是明智之举.
我不确定为什么Visual Studio停止看到DLL,但这让我解决了这个问题.
我相信我能找到解决办法。我的解决方案中有几个项目。

我的数据库逻辑位于 SqlDataAccess 中。WebUI 中引用了该程序集。
我从 DomainLogic 开始。在那里为存储库基类定义 POCO。
然后我添加了SqlDataAccess项目。
并尝试Enable-Migrations, Add-Migration并Update-Database指挥。它运行良好。在我将 WebUI(基于 MVC 4 的 Web 应用程序)添加到项目并运行上面的命令后。我开始收到此版本错误。
我卸载项目WebUI并重新运行命令。它再次运行良好。因此,即使这不是最佳解决方案,您也可能需要卸载其他项目,将数据库项目保留在解决方案中,然后运行这些命令。这对我有用。一切顺利!
| 归档时间: |
|
| 查看次数: |
10095 次 |
| 最近记录: |