温馨提示:本文翻译自stackoverflow.com,查看原文请点击:c# - Add-Migration showing error EntityFrameworkCore.Design is not installed
c# entity-framework entity-framework-core nuget visual-studio

c# - Add-Migration显示错误EntityFrameworkCore.Design未安装

发布于 2020-04-11 23:01:54

我在这里关注EntityFrameworkCore的教程,网址https://docs.efproject.net/zh/staging/platforms/aspnetcore/new-db.html 但是当我到达教程https://docs.efproject的创建数据库部分时 .net / en / staging / platforms / aspnetcore / new-db.html#create-your-database 并运行命令Add-Migration MyFirstMigration我得到以下错误:

Cannot execute this command because Microsoft.EntityFrameworkCore.Design is not installed. Install the version of that package that matches the installed version of Microsoft.EntityFrameworkCore and try again.

我想在NuGet上安装Microsoft.EntityFrameworkCore.Design以及Microsoft.EntityFrameworkCore.SqlServer.Design的每个单个版本,但仍然会遇到相同的错误。

我还尝试使用以下命令在NuGet PM之外运行

  • 点网还原
  • dotnet ef迁移添加MyFirstMigration

并得到以下错误:

Unhandled Exception: System.MissingMethodException: Entry point not found in assembly 'Microsoft.EntityFrameworkCore.Design, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.

我尝试了所有可以想到的一切,并在Internet上无处不在,但仍然没有找到答案。

查看更多

提问者
Destino
被浏览
89
alanh 2016-11-05 02:03

检查您的project.json是否包含这些条目

在依赖项下:

"Microsoft.EntityFrameworkCore.Design": {
  "version": "1.0.0-preview2-final",
  "type": "build"
},

"Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",

在工具下:

"Microsoft.EntityFrameworkCore.Tools": {
  "version": "1.0.0-preview2-final",
  "imports": [
    "portable-net45+win8+dnxcore50",
    "portable-net45+win8"
  ]
},

最新帖子

最新文章