我最近安装了 .NET Core 1.0 RC2,我知道命令 DNX 已更改为 dotnet.exe 命令,但我知道我找不到如何创建新的 EF7 迁移文件。 无论我尝试“dotnet ef”命令 我明白了
dotnet : No executable found matching command "dotnet-ef"
At line:1 char:1
+ dotnet ef
+ ~~~~~~~~~
+ CategoryInfo : NotSpecified: (No executable f...and "dotnet-ef":String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
还有类似的东西,如果尝试从 VS PS 控制台中的“添加迁移”命令女巫给我这个:
Add-Migration : The term 'Add-Migration' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Add-Migration
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Add-Migration:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我在谷歌上搜索了 3 个小时,但没有任何结果。
我觉得好像少了一个包。
这里有人成功创建了新的 EF7 迁移类吗?安装 RC2 之后?
最佳答案
命令在Tools中包,因此在包管理器控制台中运行以下命令(或通过 NuGet 包管理器 UI 添加包):
Install-Package Microsoft.EntityFrameworkCore.Tools –Pre
几天前,我将一个带有 EF Core 1 RC2 的小应用程序推送到 GitHub ,其中添加迁移工作。如有必要,您可以将其作为引用。
关于c# - EF7 .NET Core 1 RC2 添加迁移失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37468792/