Asp.net 实体框架核心迁移工具发布Visual Studio 2019
生成数据库迁移时,我遇到以下错误:- 命令提示:-Asp.net 实体框架核心迁移工具发布Visual Studio 2019,asp.net,entity-framework,asp.net-core,Asp.net,Entity Framework,Asp.net Core,生成数据库迁移时,我遇到以下错误:- 命令提示:- C:Shop\eWebShop\Web>dotnet ef migrations add "InitialDatabase" --context WebContext -p ../Persistence/Persistence.csproj -o Data/Migrations 错误:- Unable to create an object of type 'WebContext'. For the different patterns
C:Shop\eWebShop\Web>dotnet ef migrations add "InitialDatabase" --context WebContext -p ../Persistence/Persistence.csproj -o Data/Migrations
错误:-
Unable to create an object of type 'WebContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
已通过包管理器控制台尝试:-
命令:-
Add-Migration InitialDatabase -Context WebContext -p Persistence -o Data/Migrations
错误:-
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 InitialDatabase -Context WebContext -p Persistence -o D ...
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Add-Migration:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
如果您使用的是.NET Core 3
您可能需要从PMC运行install命令
我认为您缺少一些程序包引用,请确保您在.csproj文件中包含了所有这些程序包引用
您使用的是什么版本的.net core?