Base solution for your next web application
Open Closed

Error in running migrations in v14.2.0-rc.1 Pre-release #12474


User avatar
0
ajayak created

Error in running migrations in v14.2.0-rc.1 Pre-release

PM> Update-Database
Build started...
Build succeeded.
System.TypeLoadException: Method 'Identifier' in type 'Microsoft.EntityFrameworkCore.Design.Internal.CSharpHelper' from assembly 'Microsoft.EntityFrameworkCore.Design, Version=8.0.11.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation.
   at Microsoft.EntityFrameworkCore.Design.DesignTimeServiceCollectionExtensions.<>c__DisplayClass0_0.<AddEntityFrameworkDesignTimeServices>b__0(ServiceCollectionMap services)
   at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.TryAddProviderSpecificServices(Action`1 serviceMap)
   at Microsoft.EntityFrameworkCore.Design.DesignTimeServiceCollectionExtensions.AddEntityFrameworkDesignTimeServices(IServiceCollection services, IOperationReporter reporter, Func`1 applicationServiceProviderAccessor)
   at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.CreateServiceCollection(DbContext context)
   at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.Build(DbContext context)
   at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String connectionString, String contextType)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String connectionString, String contextType)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Method 'Identifier' in type 'Microsoft.EntityFrameworkCore.Design.Internal.CSharpHelper' from assembly 'Microsoft.EntityFrameworkCore.Design, Version=8.0.11.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation.
Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

1 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @ajayak

    Thank you for your feedback.

    The issue you are facing is a dependency conflict. It's caused by the AspNetCore.HealthChecks.UI package in your Web.Core project, which requires Microsoft.EntityFrameworkCore.Design version 8.0.11

    There are two alternative ways to resolve this problem:

    Alternative 1: Use the dotnet ef Command

    Without changing your current package configuration, you can create migrations directly from the command-line interface (CLI) using the dotnet ef migrations command.

    Alternative 2: Upgrade the Package Version

    Another method is to manually update the Microsoft.EntityFrameworkCore.Design package in the affected projects: Web.Core, Host, Mvc, and Public.

    You can upgrade this package to version 9.0.5 to ensure compatibility and add it as a top-level dependency to your projects. This action will override the transitive version inherited from another package, forcing the project to use the newer version you specified.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)