问题
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.
- Installed Microsoft.EntityFrameworkCore.Design 3.0.0 using NuGet
Ran
dotnet tool restore
which was successfully this timedotnet 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