实体框架核心中的添加迁移错误

Abh*_*D K 5 c# entity-framework-core

我正在关注Julie Lerman的Entity Framework Core 2.0入门教程.我已经安装了Microsoft.EntityFrameworkCore.SqlServer版本2.0.2.当我尝试在VS 2017中运行add-migration initial(包管理器控制台)时,我收到以下错误:

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' 当我跑步时,dotnet --version i get 2.1.3.任何人都可以帮助我纠正这个错误.

截图:

在此输入图像描述

提前致谢.

小智 1

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

PM> install-package Microsoft.EntityFrameworkCore.SqlServer
Run Code Online (Sandbox Code Playgroud)

默认项目设置为SomeUI

这样做之后,我能够add-migration initial毫无问题地运行它。