Cannot list Entity Framework Migrations in Visual Studio 2019 due to dotnet ef dbcontext --json failure

别说谁变了你拦得住时间么 提交于 2020-04-15 21:55:48

问题


I have an ASP.NET Core 3.0 project that uses .NET Core 3.0. I have recently upgraded VS 2019 to version 16.4.1.

I use Web Publish from Visual Studio to deploy the application on various environments, but this failed after the upgrade due to EF migrations (trying to find the db contexts failed):

dotnet ef dbcontext --json failure

Run "dotnet tool restore" to make the "dotnet-ef" command available.

I tried to understand what is wrong.

dotnet tool restore

Cannot find a manifest file. For a list of locations searched, specify the "-d" option before the tool name. No tools were restored.

dotnet tool install --global dotnet-ef

Tool 'dotnet-ef' is already installed.

dotnet tool list

Package Id Version Commands Manifest

(there are not items in this list)

dotnet-ef --version

Entity Framework Core .NET Command-line Tools 3.1.0

dotnet --version

3.1.100

Do I need to upgrade to upgrade everything to 3.1? I would like to postpone this if possible (I have to do this on multiple environments and it is scheduled at a later time).

Note: I also have Visual Studio 2017 and Entity Framework Migrations contexts are properly discovered when configuring the publishing profile.

Question: How to solve Cannot list Entity Framework Migrations in Visual Studio 2019 due to dotnet ef dbcontext --json failure?


回答1:


I think I got it solved. I was lacking Microsoft.EntityFrameworkCore.Design.

  1. Installed Microsoft.EntityFrameworkCore.Design 3.0.0 using NuGet
  2. Ran dotnet tool restore which was successfully this time

    dotnet tool restore

Tool 'dotnet-ef' (version '3.1.0') was restored. Available commands: dotnet-ef



来源:https://stackoverflow.com/questions/59320858/cannot-list-entity-framework-migrations-in-visual-studio-2019-due-to-dotnet-ef-d

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!