未找到注释 'SqlServer:Include'。确保已经添加注解ASP.Net MVC
The annotation 'SqlServer:Include' was not found. Ensure that the annotation has been added ASP.Net MVC
我有一个 asp.net MVC 代码优先项目。
当我 运行 在 Nuget 控制台中执行此命令时:
"update-database"
它returns这个错误:
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>
这个项目不是核心...
我该怎么办?
感谢您的回复...
更新 Microsoft.EntityFrameworkCore ,Microsoft.EntityFrameworkCore.SqlServer 和 Microsoft.EntityFrameworkCore.Tools 到版本 2.2.0 或更高版本:)
我有一个 asp.net MVC 代码优先项目。 当我 运行 在 Nuget 控制台中执行此命令时:
"update-database"
它returns这个错误:
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>
这个项目不是核心...
我该怎么办?
感谢您的回复...
更新 Microsoft.EntityFrameworkCore ,Microsoft.EntityFrameworkCore.SqlServer 和 Microsoft.EntityFrameworkCore.Tools 到版本 2.2.0 或更高版本:)