无法在VS 2017 .NET Core上启用实体框架的迁移 [英] Can't enable migrations for Entity Framework on VS 2017 .NET Core
问题描述
- Microsoft.EntityFrameworkCore(1.1.0)
- Microsoft.NETCore .App(1.1.0)
我还创建了一个名为Models的文件夹,其中包含一个类。然后,我去了Package Manager控制台并执行了 enable-migrations ,以便VS将创建我需要的文件。但是,而不是所需的文件,我收到以下错误。
术语启用迁移不被识别为一个cmdlet,函数,脚本文件或可操作的程序。检查名称的拼写,或者如果包含路径,请验证
路径是否正确,然后重试。
我应该在这里做什么?
我似乎没有运气的谷歌搜索。这是一个非常不寻常的组合(Core VS17和EF),所以几乎没有关于这个问题的信息。一些指南谈到编辑package.json是一种很难的事情,因为VS 2017似乎升级了Core,以使得网络恢复不会找到它,而是一个 xxx.csproj
总之,我很困惑,很不确定如何解决问题。
EF Core不再有启用迁移
命令。默认情况下启用迁移。使用 Add-Migration添加新迁移
。
有关软件包管理器命令的文档在这里
I just installed VS 2017 and created a new Core project. Inside it, I added:
- Microsoft.EntityFrameworkCore (1.1.0)
- Microsoft.NETCore.App (1.1.0)
I also created a folder called Models with a class in it. Then, I went to the Package Manager Console and executed enable-migrations so that VS will create the files needed for me. However, instead of the needed files, I got the following error.
The term 'enable-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.
What am I supposed to do here?
I seem to be out of luck googling. It's a very unusual combination (Core VS17 and EF) so there's virtually no info on the subject. Some guides talk about editing package.json by hand which is kind of hard because VS 2017 seems to upgrade the Core so that dotnet restore doesn't look for it but rather for a xxx.csproj.
In summary, I'm confused and quite uncertain how to bite the problem.
EF Core does not have Enable-Migrations
command anymore. Migrations are enabled "by default". Add new migration with Add-Migration
.
Documentation about package manager commands is here
这篇关于无法在VS 2017 .NET Core上启用实体框架的迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!