我一直在尝试修复一个项目,因此它具有IdentityServer4的db脚本。我被告知要跑步

dotnet ef migrations add InitialIdentityServerMigration -c PersistedGrantDbContext


但是,当我运行该程序时,我收到一个错误:


  dotnet:找不到与命令“ dotnet-ef”匹配的可执行文件


所以我遵循了几个resources来获取dotnet-ef

我安装了一些nuget包:


Microsoft.EntityFrameworkCore.Tools
Microsoft.EntityFrameworkCore.Design


但仍然令我收到相同的错误消息。

还有另一种获取Identity4 DB脚本的方法吗?

最佳答案

尝试在程序包管理器控制台(正在使用Powershell)中运行较旧样式的语法。

Add-Migration InitialIdentityServerPersistedGrantDbMigration -c PersistedGrantDbContext -o Data/Migrations/IdentityServer/PersistedGrantDb
Add-Migration InitialIdentityServerConfigurationDbMigration -c ConfigurationDbContext -o Data/Migrations/IdentityServer/ConfigurationDb
Update-Database -c PersistedGrantDbContext
Update-Database -c ConfigurationDbContext

关于c# - 如何在不进行迁移的情况下生成Identity DB脚本,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42600636/

10-11 20:55