I set up an Entity Framework database using code first, and whenever I attempt to add a migration or update the database, I get the following error: message of error
PM> update-database Exception calling "CreateInstance" with "7" argument(s): "Constructor on type 'System.Data.Entity.Migrations.Utilities.DomainDispatcher' not found." At D:\WTS Projects\ModelCalibration\packages\EntityFramework.6.2.0\tools\EntityFramework.psm1:783 char:5 + $dispatcher = $utilityAssembly.CreateInstance( + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) , MethodInvocationException + FullyQualifiedErrorId : MissingMethodException System.NullReferenceException: Object reference not set to an instance of an object. at System.Data.Entity.Migrations.MigrationsDomainCommand.WriteLine(String message) at System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0() at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command) Object reference not set to an instance of an object.
The database migration went without a hitch once I transferred the project to a different machine running the identical versions of Visual Studio, Entity Framework, and Windows. I also downloaded the example project on these two computers (docs) and received the same problem on this one but not on the other, therefore I don't think it has anything to do with my code.
The only fix I could discover was on this topic, here, and it included reinstalling Windows, which I don't really want to do.
Additionally, I have done everything suggested in related SO postings like When I attempt to activate migrations in EF 4.3.1, an exception is generated., which instructed how to fix Visual Studio and reinstall Entity Framework, among other things.
I'm using Windows 10, the.NET Framework 4.6.1, Visual Studio 15.8.4, and the Entity Framework 6.2.0.
Had anybody seen this problem previously or has a suggestion for a fix?
Sometimes it's effective to just clean and rebuild your solution.