实体框架核心中的添加迁移错误 [英] Add-Migration Error in Entity Framework Core

查看:62
本文介绍了实体框架核心中的添加迁移错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注Julie Lerman的Entity Framework Core 2.0入门教程。我已经安装了Microsoft.EntityFrameworkCore.SqlServer版本2.0.2。当我尝试在VS 2017中运行add-migration initial(Package Manager Console)时,出现以下错误:

I am following Julie Lerman's Getting Started with Entity Framework Core 2.0 tutorial. I have installed Microsoft.EntityFrameworkCore.SqlServer Version 2.0.2. When I try to run add-migration initial (Package Manager Console) in VS 2017 I am obtaining the below error :


System .IO.FileLoadException:无法加载文件或程序集'Microsoft.EntityFrameworkCore.SqlServer,版本= 2.0.2.0,区域性=中性,PublicKeyToken = adb9793829ddae60'。找到的程序集的清单定义与程序集引用不匹配。 (来自HRESULT的异常:0x80131040)
文件名:'Microsoft.EntityFrameworkCore.SqlServer,版本= 2.0.2.0,区域性=中性,PublicKeyToken = adb9793829ddae60'

当我运行 dotnet --version时,我得到2.1.3。谁能帮助我纠正此错误。

System.IO.FileLoadException: Could not load file or assembly 'Microsoft.EntityFrameworkCore.SqlServer, Version=2.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) File name: 'Microsoft.EntityFrameworkCore.SqlServer, Version=2.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' When I run dotnet --version i get 2.1.3. Can anybody help me rectify this error.

屏幕截图:

感谢提前。

推荐答案

在同样的Pluralsight视频之后,我遇到了同样的问题。运行后:

Following the very same Pluralsight video, I ran into this same problem. After running:

PM> install-package Microsoft.EntityFrameworkCore.SqlServer

默认项目设置为 SomeUI

我能够获得添加迁移的初始内容这样做后完全没有任何问题。

I was able to get the add-migration initial to run without any problems at all, after doing so.

这篇关于实体框架核心中的添加迁移错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆