找不到注释'SqlServer:Include'。确保已添加注释ASP.Net MVC

问题描述 投票:2回答:1

我有一个asp.net MVC代码第一个项目。当我在Nuget控制台中运行此命令时:

“更新数据库”

它返回此错误:

    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> 

此项目不是核心...

我该怎么办?

感谢您的回复...

c# asp.net-mvc entity-framework entity-framework-core code-first
1个回答
0
投票

将Microsoft.EntityFrameworkCore,Microsoft.EntityFrameworkCore.SqlServer和Microsoft.EntityFrameworkCore.Tools更新到版本2.2.0或更高版本:)

© www.soinside.com 2019 - 2024. All rights reserved.