【问题标题】:No response EF Core migrations "Add-Migration" command没有响应 EF Core 迁移“添加迁移”命令
【发布时间】:2018-02-09 16:51:58
【问题描述】:

情况:

在我的 W10 笔记本电脑损坏后,我不得不将系统恢复到之前的状态。我所有的软件都不见了(包括 VS 2K17、SQL SERVER、Office 等)。我所有的项目文件都没有动过。

全部重新安装后,我尝试执行以下命令:

添加迁移 20180209 -verbose

只是为了找回这个:

找到多个启动项目。 使用项目“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 --verbose --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

有什么想法吗?我已经删除了项目中的 bin 和 obj 文件夹并重新执行以获取相同的响应

也已删除“迁移”文件夹。没有成功。

如果我切换到错误的启动项目,我确实会收到预期的消息:

在程序集“Any.Gym.API”中未找到 DbContext。确保您使用的是正确的程序集,并且该类型既不是抽象的也不是泛型的。

【问题讨论】:

    标签: entity-framework migration .net-core asp.net-core-2.0 entity-framework-migrations


    【解决方案1】:

    已解决。这是 EF 的问题。

    参考: https://github.com/aspnet/EntityFrameworkCore/issues/10926 https://github.com/aspnet/EntityFrameworkCore/issues/10298

    将此添加到上下文类 csproj:

    <PropertyGroup>
      <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
    </PropertyGroup>
    

    【讨论】:

      猜你喜欢
      • 2017-05-30
      • 2021-11-23
      • 2018-02-10
      • 1970-01-01
      • 2017-11-30
      • 2018-11-30
      • 1970-01-01
      • 1970-01-01
      • 2022-11-11
      相关资源
      最近更新 更多