EF迁移文件在文件系统中可见,但在项目文件夹c#中不可见

我使用Add-Migration创建了一个新的Migrations,并且能够在我的本地主机数据库上成功运行update-database。但是,当我将代码合并到git branch并尝试部署时,出现以下错误。

System.Data.Entity.Migrations.Infrastructure.AutomaticMigrationsDisabledException: Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration.

因此,当我克隆分支时,我发现项目中缺少迁移文件“ 201911070247123_UpdateInsureZonetables.cs”。

EF迁移文件在文件系统中可见,但在项目文件夹c#中不可见

,但它存在于文件系统中。

EF迁移文件在文件系统中可见,但在项目文件夹c#中不可见

当我查看具有先前成功迁移的请求请求时,我的构建缺少.csproj文件中的引用。

EF迁移文件在文件系统中可见,但在项目文件夹c#中不可见

我删除并重新创建了Migration,这次更新了.csproj文件。

.csproj文件未更新是否是VS错误?但是,如果其他人遇到这种情况,我认为您可以在csproj文件中手动添加迁移参考,而不必删除并重新创建迁移。

kykooo 回答:EF迁移文件在文件系统中可见,但在项目文件夹c#中不可见

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3143316.html

大家都在问