找不到方法:'Void EntityFrameworkCore.Design.Internal.DbContextOperations

sae*_*med 5 entity-framework-core asp.net-core-mvc

我正在尝试搭建脚手架并收到以下错误:

运行选定的代码生成器时出错找不到方法:'Void EntityFrameworkCore.Design.Internal.DbContextOperations

mve*_*mef 3

https://learn.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-db?view=aspnetcore-2.0#install-entity-framework

我怀疑您缺少脚手架所需的组件?我还假设您正在尝试对现有数据库进行逆向工程?

例子 Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models

如果它像我找不到一样失败,可能是 pmc 问题,请尝试关闭 VS 再试一次。之后,它可能是缺少组件的配置。