【问题标题】:.designer file of migration in EF core not being associated with .cs file in visual studioEF 核心中迁移的 .designer 文件未与 Visual Studio 中的 .cs 文件关联
【发布时间】:2019-08-21 20:16:17
【问题描述】:

我创建了一个 .NET Core 应用程序。我正在使用带有代码优先方法的 Entity Framework Core,并且正在创建迁移。

由于某种原因,迁移的.designer.cs 文件未与主体.cs 文件关联。

我看过这个solution,但它似乎不适用于 .net 核心应用程序。

有什么帮助吗?

谢谢

【问题讨论】:

  • 我的也是独立的,但运行它没有问题。

标签: .net-core visual-studio-2017 entity-framework-core entity-framework-migrations


【解决方案1】:

尝试使用 Update 而不是 Include

在您的.csproj 文件中,将这些行添加到ItemGroup

<Compile Update="yourfilename.Designer.cs">
    <DependentUpon>yourfilename.cs</DependentUpon>
</Compile>

【讨论】:

  • 如果您使用 Microsoft Identity Core,它会生成第一个名为 CreateIdentitySchema 的迁移,其中 Deisgner.cs 的子代... 但是如果我使用 add-migration 生成它,就会出现问题错了......但是一切正常......这只是个人的“痴迷”
猜你喜欢
  • 2014-07-31
  • 2021-06-14
  • 1970-01-01
  • 2022-06-15
  • 2018-03-03
  • 1970-01-01
  • 2018-05-15
  • 1970-01-01
  • 2020-03-08
相关资源
最近更新 更多