Why is AutomaticMigrationsDisabledException thrown?

We have

  • Old web project
  • New web project
  • Class library containing all Entity Framework code

All three projects reference Entity Framework 6.1.3.

The class library is shared by an old web project and a new web project. Both web projects have a file link for the class library. Both of them point to the same place on the disk.

Both web projects are configured to use the same database.

When I run the Old web project in Visual Studio, it works fine.

When I try to start a new web project in Visual Studio, it throws an AutomaticMigrationsDisabledException.

When I temporarily add ClassLibrary.csproj to the solution for a new web project and run

Add-Migration TestMigration -ConfigurationTypeName MyConfiguration -ProjectName ClassLibrary -StartupProjectName NewWebProject -ConnectionStringName MyContext

it aligns the migration with the empty Up () and Down () methods, indicating that it did not find the changes in the end.

What could cause the New Web Project to throw an AutomaticMigrationsDisabledException in these circumstances? How can I further diagnose the problem?

+4
source share
1 answer

I very carefully checked that the link to the New Web Project file on ClassLibrary.dll is correct and that the corresponding DLL is relevant.

As a test, I added a new method for the class in ClassLibrary.dll and found that the New Web Project could not solve it.

, .

ClassLibrary.dll , "" .

+1

Source: https://habr.com/ru/post/1589048/


All Articles