gpt4 book ai didi

entity-framework - 代码优先迁移 MissingManifestResourceException

转载 作者:行者123 更新时间:2023-12-01 15:32:10 28 4
gpt4 key购买 nike

我目前正在为新数据库创建 InitialCreate 迁移。我是这个迁移框架的新手,不知道它到底生成了什么,我一直在运行 update-database查看结果,删除数据库然后运行 ​​update-database进行一些更改后再次查看结果。

现在我做了两次更改,去运行更新并收到如下错误:

Applying code-based migration: 201209121936571_InitialCreate. System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "$assemblyName$.resources" was correctly embedded or linked into assembly "$assemblyName$" at compile time, or that all the satellite assemblies required are loadable and fully signed. at [StackTrace]



然后它以红色结尾

Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "$assemblyName$.Migrations.InitialCreate.resources" was correctly embedded or linked into assembly "$assemblyName$" at compile time, or that all the satellite assemblies required are loadable and fully signed.



我第一次遇到这种情况时,我删除了迁移文件夹,运行 enable-migrations重新进行了更改并能够运行迁移。

它再次发生,我不想每次发生这种情况时都必须重新创建文件。有谁知道如何更正此问题以使迁移再次工作?

最佳答案

对我来说,解决方案是在我投影的 .csproj 文件中添加以下代码,在 <PropertyGroup>

<EmbeddedResourceUseDependentUponConvention>true</EmbeddedResourceUseDependentUponConvention>

之后 Update-Database 命令工作正常。

关于entity-framework - 代码优先迁移 MissingManifestResourceException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12417737/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com