簡體   English   中英

EF Core 5.0.5 Add-Migration 字符串參數“名稱”不能為空

[英]EF Core 5.0.5 Add-Migration The string argument 'name' cannot be empty

我在Add-Migration方面遇到問題,並給了我一個錯誤The string argument 'name' cannot be empty. . 我嘗試像這樣執行此命令: Add-Migration Update_Add_User

這是錯誤:

構建開始...構建成功。 System.ArgumentException:字符串參數“名稱”不能為空。 在 Microsoft.EntityFrameworkCore.Utilities.Check.NotEmpty(String value, String parameterName) 在 Microsoft.EntityFrameworkCore.Design.Internal.CSharpHelper.Identifier(String name, ICollection 1 scope) at Microsoft.EntityFrameworkCore.Migrations.Design.CSharpMigrationOperationGenerator.Generate(CreateTableOperation operation, IndentedStringBuilder builder) at Microsoft.EntityFrameworkCore.Migrations.Design.CSharpMigrationOperationGenerator.Generate(String builderName, IReadOnlyList Microsoft.EntityFrameworkCore.Migrations.Design.CSharpMigrationsGenerator.GenerateMigration(String migrationNamespace, String migrationName, IReadOnlyList 1 upOperations, IReadOnlyList 1 scope) at Microsoft.EntityFrameworkCore.Migrations.Design.CSharpMigrationOperationGenerator.Generate(CreateTableOperation operation, IndentedStringBuilder builder) at Microsoft.EntityFrameworkCore.Migrations.Design.CSharpMigrationOperationGenerator.Generate(String builderName, IReadOnlyList 1 operations, IndentedStringBuilder builder) 1 upOperations, IReadOnlyList 1 downOperations) 在 Microsoft.EntityFrameworkCore.Migrations.Design.MigrationsScaffolder.ScaffoldMigration(String migrationName, String rootNamespace, String subNamespace, String language) at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.AddMigration(String n ame, String outputDir, String contextType, String namespace) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType, String namespace) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigration.<>c__DisplayClass0_0.< .ctor>b__0() 在 Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.b__0() 在 Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action) 字符串參數“名稱”不能空的。

誰能告訴我如何解決這個問題?

更新:Nuget 包

Microsoft.EntityFrameworkCore 5.0.5 Microsoft.EntityFrameworkCore.SqlServer 5.0.5 Microsoft.EntityFrameworkCore.Design 5.0.5

確保添加 nuget package Microsoft.EntityFrameworkCore.Tools否則您將無法在 Package 管理器控制台上運行 EF 命令。

Install-Package Microsoft.EntityFrameworkCore.Tools -Version 5.0.5

如果您使用dotnet ef add-migration nameOfMigration會出現同樣的錯誤嗎?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM