Monday, February 29, 2016

More than one migrations configuration type was found in the assembly 'MyData'. Specify the name of the one to use.

I was recently running an Add-Migration command using Entity Framework Code First Migrations, when I encountered the following error message:

"More than one migrations configuration type was found in the assembly 'MyData'. Specify the name of the one to use."

As I soon discovered, I was using multiple Configuration.cs classes (to correspond to my multiple DbContext instances) in my assembly, thus causing the Add-Migration command to fail with this error message.

Therefore, I had to modify the command to be the following instead:


Add-Migration "MyMigration" -ProjectName "MyProject" -StartUpProjectName "MyProject" -ConnectionStringName "MyConnString" -ConfigurationTypeName "MyMigration.Configuration" -Force Verbose

No comments:

Post a Comment