Search code examples
c#asp.net-mvcentity-frameworkentity-framework-corecode-first

The annotation 'SqlServer:Include' was not found. Ensure that the annotation has been added ASP.Net MVC


I have an asp.net MVC Code first project. when i run this command in Nuget console :

"update-database"

it returns this error:

    PM> update-database
Applying migration '20180623170538_natinalCode'.
System.InvalidOperationException: The annotation 'SqlServer:Include' was not found. Ensure that the annotation has been added.
   at Microsoft.EntityFrameworkCore.Infrastructure.AnnotatableExtensions.GetAnnotation(IAnnotatable annotatable, String annotationName)
   at Microsoft.EntityFrameworkCore.Migrations.SqlServerMigrationsSqlGenerator.<GetIndexesToRebuild>d__48.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Microsoft.EntityFrameworkCore.Migrations.SqlServerMigrationsSqlGenerator.Generate(AlterColumnOperation operation, IModel model, MigrationCommandListBuilder builder)
   at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.Generate(MigrationOperation operation, IModel model, MigrationCommandListBuilder builder)
   at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.Generate(IReadOnlyList`1 operations, IModel model)
   at Microsoft.EntityFrameworkCore.Migrations.SqlServerMigrationsSqlGenerator.Generate(IReadOnlyList`1 operations, IModel model)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.GenerateUpSql(Migration migration)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
   at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
The annotation 'SqlServer:Include' was not found. Ensure that the annotation has been added.
PM> 

This project isn't Core...

What should i do?

thank for your response...


Solution

  • Update Microsoft.EntityFrameworkCore ,Microsoft.EntityFrameworkCore.SqlServer and Microsoft.EntityFrameworkCore.Tools to version 2.2.0 or later :)