.net core 2.1 EF Core reverse engineering errors V

2019-07-24 06:59发布

问题:

Not having a great time with doing EF Core Reverse Engineering.

Latest error

The method or operation is not implemented.

Scaffold-DbContext "The method or operation is not implemented"

i get the same errors for both of these commands

Running this from Package Manager Console within VS 2017:

Scaffold-DbContext 'Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Chinook' Microsoft.EntityFrameworkCore.SqlServer

and from command prompt:

dotnet ef dbcontext scaffold "Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Chinook" Microsoft.EntityFrameworkCore.SqlServer

Yes, I do alter them to have both my data source and database.

I get this error

Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4. 0.3.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRES ULT: 0x80131040)

I have gotten this before and after i upgraded to the .net core SDK 2.2.101

FYI, my csproj file looks like this

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.4" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.4">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.3" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.4" />
  </ItemGroup>

</Project>

回答1:

Between installing the EF power Tools and the Latest Core 2.2.x.x SDK I am now able to change my project to use dropdown change to the .net core 2.2 (it was previously only able to do 2.1.

Then with Nuget updates etc.. , it finally works!