[英]No response EF Core migrations “Add-Migration” command
情况:
在我的W10笔记本电脑上损坏后,我不得不将系统还原到以前的位置。 我所有的软件都丢失了(包括VS 2K17,SQL SERVER,Office等)。 我所有的项目文件均未修改。
重新安装它们后,我尝试执行以下命令:
Add-Migration 20180209-详细
只是为了得到这个:
找到了多个启动项目。 使用项目“ 3-Infrastructure \\ Any.Gym.Infrastructure.Context”。 使用启动项目“ 3-Infrastructure \\ Any.Gym.Infrastructure.Context”。 构建开始...构建成功。 C:\\ Program Files \\ dotnet \\ dotnet.exe exec --depsfile C:\\ Users \\ FILENGA \\ Source \\ repos \\ Any.Gym \\ Any.Gym.Infrastructure.Context \\ bin \\ Debug \\ netcoreapp2.0 \\ Any.Gym。 Infrastructure.Context.deps.json --additionalprobingpath C:\\ Users \\ FILENGA.nuget \\ packages --additionalprobingpath“ C:\\ Program Files \\ dotnet \\ sdk \\ NuGetFallbackFolder” --fx-version 2.0“ C:\\ Program Files \\ dotnet \\ sdk \\ NuGetFallbackFolder \\ microsoft.entityframeworkcore.tools \\ 2.0.1 \\ tools \\ netcoreapp2.0 \\ ef.dll“迁移中添加20180209 --json-详细--no-color --prefix-output --assembly C:\\ Users \\ FILENGA \\ Source \\ repos \\ Any.Gym \\ Any.Gym.Infrastructure.Context \\ bin \\ Debug \\ netcoreapp2.0 \\ Any.Gym.Infrastructure.Context.dll --startup-assembly C:\\ Users \\ FILENGA \\ Source \\ repos \\ Any.Gym \\ Any.Gym.Infrastructure.Context \\ bin \\ Debug \\ netcoreapp2.0 \\ Any.Gym.Infrastructure.Context.dll --project-dir C:\\ Users \\ FILENGA \\ Source \\ repos \\ Any。 Gym \\ Any.Gym.Infrastructure.Context \\ --root-namespace Any.Gym.Infrastructure.Context
任何想法? 我已经删除了项目中的obj文件夹,并重新执行,只是为了获得相同的响应
也已经删除了“ MIGRATION”文件夹。 没有成功
如果我切换到错误的启动项目,则会收到预期的消息:
在程序集“ Any.Gym.API”中未找到DbContext。 确保使用正确的程序集,并且类型既不是抽象的也不是泛型的。
解决。 这是EF的问题。
参考: https : //github.com/aspnet/EntityFrameworkCore/issues/10926 https://github.com/aspnet/EntityFrameworkCore/issues/10298
将此添加到上下文类csproj:
<PropertyGroup>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
</PropertyGroup>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.