无法首先在数据库上启用代码迁移,从而导致以下错误 [英] Unable to enable-migrations for code first on a database getting the following error
问题描述
大家好,
我正在使用Code First方法来创建和修改我的数据库。当我在两种情况下尝试在New get packages的包管理控制台上运行Enable-Migrations或Add-Migration CreateInstance时,我收到相同的错误以下错误。任何人都可以帮我解决这个问题。
这是我得到的错误
Hi All,
I am using Code First approach to create and modify my database. When I am trying to run the Enable-Migrations or Add-Migration CreateInstance on Package Management Console of New get packages in both cases I am getting the same error the following error. Can anybody please help me in resolving this issue.
This is the error that I am getting
Exception calling "CreateInstanceFrom" with "8" argument(s): "Could not load file or assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' o
r one of its dependencies. The system cannot find the file specified."
At C:\Users\Abdul.Aleem\Desktop\TestWPFApplication\packages\EntityFramework.5.0.0\tools\EntityFramework.psm1:431 char:31
+ $domain.CreateInstanceFrom <<<< (
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodTargetInvocation
我尝试了什么:
谷歌搜索并尝试使用不同的组合并向朋友展示帮助
What I have tried:
Google Search and trying with different combinations and showing it friends for help
推荐答案
domain.CreateInstanceFrom<<<<(
+ CategoryInfo:NotSpecified:(:) [],MethodInvocationException
+ FullyQualifiedErrorId:DotNetMethodTargetInvocation
domain.CreateInstanceFrom <<<< ( + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodTargetInvocation
我尝试过:
Google搜索并尝试不同的组合并向朋友展示帮助
What I have tried:
Google Search and trying with different combinations and showing it friends for help
看起来你从某个地方复制了这个项目,但没有复制整个东西。包文件夹似乎缺少所有的包。 />
右键单击解决方案资源管理器中的解决方案行,然后单击恢复器 e NuGet包。这将重新安装任何丢失的软件包。
如果不起作用,请打开软件包管理器控制台并输入:
It would appear that you copied this project from somewhere but didn't copy the whole thing. The packages folder seems to be missing all of the packages.
Right-click the Solution line in the Solution Explorer and click "Restore NuGet packages". That will reinstall any missing packages.
If the doesn't work, open the Package Manager Console and type:
Update-Package
这将安装解决方案中所有软件包的最新版本,包括实体框架到6.1.3。
That will install the latest versions of all the packages in your solution, including Entity Framework to 6.1.3.
这篇关于无法首先在数据库上启用代码迁移,从而导致以下错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!