efcore: Method not found: 'System.String Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.DisplayName(Microsoft.EntityFrameworkCore.Metadata.IEntityType)'.

Hi. I have read #6865, #6855, and https://blogs.msdn.microsoft.com/dotnet/2016/10/25/announcing-entity-framework-core-1-1-preview-1/ from the release.

I am trying to run Scaffold-DbContext "Server=(A);Database=B;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Verbose

I am getting the error Method Not Found as per the title (full error at the bottom). To try and resolve this I have

  • updated the listed packages as detailed in the release blog.
  • Kept using netcore 1.0.0
  • run dotnet restore (many times)
  • restarted VS and my machine (many times)

I have read that I may need to delete the Entity Framework directory under %USERPROFILE%/.nuget … but that seems a bit drastic.

Below is my project.json … I think I a missing something small and would appreciate any pointers to help through this. I did try rolling back to preview2-final on tools but it all seems to have gone a bit wrong.

`{ “dependencies”: { “Microsoft.AspNetCore.Authentication”: “1.0.0”, “Microsoft.AspNetCore.Authentication.Cookies”: “1.0.0”, “Microsoft.AspNetCore.Authorization”: “1.0.0”, “Microsoft.AspNetCore.Diagnostics”: “1.0.0”, “Microsoft.AspNetCore.Identity”: “1.0.0”, “Microsoft.AspNetCore.Mvc”: “1.0.1”, “Microsoft.AspNetCore.Razor.Tools”: { “version”: “1.0.0-preview2-final”, “type”: “build” }, “Microsoft.AspNetCore.Routing”: “1.0.1”, “Microsoft.AspNetCore.Server.IISIntegration”: “1.0.0”, “Microsoft.AspNetCore.Server.Kestrel”: “1.0.1”, “Microsoft.AspNetCore.Session”: “1.0.0”, “Microsoft.AspNetCore.StaticFiles”: “1.0.0”, “Microsoft.EntityFrameworkCore.Design”: “1.0.1”, “Microsoft.EntityFrameworkCore.SqlServer”: “1.1.0-preview1-final”, “Microsoft.EntityFrameworkCore.SqlServer.Design”: “1.1.0-preview1-final”, “Microsoft.EntityFrameworkCore.Tools.DotNet”: “1.0.0-preview3-final”, “Microsoft.Extensions.Configuration.EnvironmentVariables”: “1.0.0”, “Microsoft.Extensions.Configuration.Json”: “1.0.0”, “Microsoft.Extensions.Logging”: “1.1.0-preview1-final”, “Microsoft.Extensions.Logging.Console”: “1.0.0”, “Microsoft.Extensions.Logging.Debug”: “1.0.0”, “Microsoft.Extensions.Options.ConfigurationExtensions”: “1.0.0”, “Microsoft.NETCore.App”: { “version”: “1.0.1”, “type”: “platform” }, “Microsoft.VisualStudio.Web.BrowserLink.Loader”: “14.0.0”, “Microsoft.VisualStudio.Web.CodeGeneration.Tools”: { “version”: “1.0.0-preview2-final”, “type”: “build” }, “Microsoft.VisualStudio.Web.CodeGenerators.Mvc”: { “version”: “1.0.0-preview2-final”, “type”: “build” } },

“tools”: { “BundlerMinifier.Core”: “2.0.238”, “Microsoft.AspNetCore.Razor.Tools”: “1.0.0-preview2-final”, “Microsoft.AspNetCore.Server.IISIntegration.Tools”: “1.0.0-preview2-final”, “Microsoft.VisualStudio.Web.CodeGeneration.Tools”: { “version”: “1.0.0-preview2-final”, “imports”: [ “portable-net45+win8” ] } },

“frameworks”: { “netcoreapp1.0”: { “imports”: [ “dotnet5.6”, “portable-net45+win8” ] } },

“buildOptions”: { “emitEntryPoint”: true, “preserveCompilationContext”: true },

“runtimeOptions”: { “configProperties”: { “System.GC.Server”: true } },

“publishOptions”: { “include”: [ “wwwroot”, “**/*.cshtml”, “appsettings.json”, “web.config” ] },

“scripts”: { “prepublish”: [ “bower install”, “dotnet bundle” ], “postpublish”: [ “dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%” ] } } ` and here is the full error message …

System.MissingMethodException: Method not found: 'System.String Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.DisplayName(Microsoft.EntityFrameworkCore.Metadata.IEntityType)'. at Microsoft.EntityFrameworkCore.Scaffolding.Internal.StringBuilderCodeWriter.WriteCodeAsync(ModelConfiguration modelConfiguration, String outputPath, String dbContextClassName, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineeringGenerator.GenerateAsync(ReverseEngineeringConfiguration configuration, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContextAsync(String provider, String connectionString, String outputDir, String dbContextClassName, IEnumerable1 schemas, IEnumerable1 tables, Boolean useDataAnnotations, Boolean overwriteFiles, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.<ScaffoldContextImpl>d__22.MoveNext() at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable1 source, Int32& length) at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable1 source) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass4_01.<Execute>b__0() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)`

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 22 (14 by maintainers)

Commits related to this issue

Most upvoted comments

You are referencing 1.0.1 of Microsoft.EntityFrameworkCore.Design:

"Microsoft.EntityFrameworkCore.Design": "1.0.1",

This package needs to match the version of the runtime you are using (1.1.0-preview1-final)

@ajcvickers will hunt and try to remove Internal usage on my side (https://github.com/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/122).

FYI RelationalModelValidator is not longer used in my 1.1.0 branch.

@jeffbromberger this means the SapientGuardian provider should work with the RTM of 1.1.0