Method not found: 'Void EntityFrameworkCore.Design.Internal.DbContextOperations

我们两清 提交于 2019-12-12 12:45:27

问题


I am trying to scaffold and getting following error:

There was an error running the selected code generator Method not found: 'Void EntityFrameworkCore.Design.Internal.DbContextOperations


回答1:


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

I suspect you are missing the assemblies that are necessary for scaffolding? I also assume you are trying to reverse engineer an existing db?

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

if it fails like i can't find it might be a pmc issue, try closing down VS try again. After that its probably a configuration with missing assemblies.




回答2:


I got this error too when trying to add a new controller. The day before I had upgraded both Microsoft.EntityFrameworkCore.SqlServer and Microsoft.EntityFrameworkCore.Tools Nuget Packages from version 2.0.2 to 2.1.3.

Downgrading both packages to 2.0.2 allowed me to scaffold a new controller again.




回答3:


It may be the Microsoft.EntityFrameworkCore.Design version issue. Uust update it to version 2.0.3. It worked for me.




回答4:


Saeef's error is from trying to create CRUD razor pages, not creating the domain classes from an existing database




回答5:


I had the same problem. I had two instances of VS2017 (enterprise & developer edition) for some reason I updated only one of them. The shourtcut on my desk was the 'out of date version' so I didnt figure it out until now. I uninstalled the older, updated the other to 15.8+ and it works fine now.



来源:https://stackoverflow.com/questions/50645265/method-not-found-void-entityframeworkcore-design-internal-dbcontextoperations

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