Scaffold-DbContext - System.TypeLoadException: Method Create - does not have an implementation

asked 2022-06-06T17:10:36.66+00:00

Hi, i am using windows 10. I am trying to install entity framework 3.1.0 to .netstandard 2.0. I installed these packages ok:
(also have a console project installed in this .netstandard solution)
Microsoft.EntityFrameworkCore.3.1.0
Microsoft.EntityFrameworkCore.Design.3.1.0
Microsoft.EntityFrameworkCore.SqlServer.2.2.2
Microsoft.EntityFrameworkCore.Tools.3.1.0

Now i am trying to create my database classes in my .netstandard project. I use this command in the package manager console :

PM> Scaffold-DbContext 'Data Source=.\MSSQLSERVER2012;Initial Catalog= MbsAnalysisData;User Id = eflogin; Password= eflogin'Microsoft.EntityFrameworkCore.SqlServer -output Models
Build started...
Build succeeded.
System.TypeLoadException: Method 'Create' in type 'Microsoft.EntityFrameworkCore.SqlServer.Scaffolding.Internal.SqlServerDatabaseModelFactory' from assembly 'Microsoft.EntityFrameworkCore.SqlServer, Version=2.2.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation.

Not sure what i am doing wrong?

thanks for any help or advice

Windows 10 Network
Windows 10 Network
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Network: A group of devices that communicate either wirelessly or via a physical connection.
1,934 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. answered 2022-06-22T15:52:14.333+00:00

    Since I am new to .net standard, I see now that this boils down to how to use EF Core WITH .net standard. Here is a great clue :
    https://devopsjournal.io/blog/2020/04/23/EntityFramework-Core-NET-Standard-Migrations .

    This is the search that i used to get to this above link " using .net standard with entity framework 3.1"

    About the "create" error, I had to make sure I had the same version 3.1) for ALL of the entity framework packages. But the way I was trying to use EF with .net standard was wrong I think.

    No comments