Add Migrations Issue - Could not load file or assembly 'TOMS.EntityFramework' or one of its dependencies. Index not found

0

I'm working on an existing solution which works fine all this while. After a few weeks, I tried to add a new migration to entity framework and got this error. All projects are currently set to build 'Any CPU'.

I'm using Net 4.6.1 and Entity Framework 6.1.3

PM> Add-Migration AddedVerifyRemarks -Verbose
Using StartUp project 'MIFE.Web'.
Using NuGet project 'MIFE.EntityFramework'.
System.BadImageFormatException: Could not load file or assembly 'TOMS.EntityFramework' or one of its dependencies. Index not found. (Exception from HRESULT: 0x80131124)
File name: 'TOMS.EntityFramework' ---> System.BadImageFormatException: Index not found. (Exception from HRESULT: 0x80131124)

   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.Load(String assemblyString)
   at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.LoadAssembly(String name)
   at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.FindConfiguration()
   at System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Run()
   at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
   at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
   at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
   at System.Data.Entity.Migrations.Design.ToolingFacade.Scaffold(String migrationName, String language, String rootNamespace, Boolean ignoreChanges)
   at System.Data.Entity.Migrations.AddMigrationCommand.Execute(String name, Boolean force, Boolean ignoreChanges)
   at System.Data.Entity.Migrations.AddMigrationCommand.<>c__DisplayClass2.<.ctor>b__0()
   at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)


Could not load file or assembly 'TOMS.EntityFramework' or one of its dependencies. Index not found. (Exception from HRESULT: 0x80131124)

I can't nail down the root cause of this problem. Any ideas on how to fix this?

c#
asp.net-mvc
entity-framework
asked on Stack Overflow Oct 25, 2017 by osheh • edited Oct 25, 2017 by Mihail Stancescu

1 Answer

1

It's quite hard to give very concrete advice in cases with "Could not load file or assembly", because it may be very specific to your project configuration. You can try this tool to diagnose causes of the issue yourself: https://marketplace.visualstudio.com/items?itemName=MykolaTarasyuk.ReferenceConflictsAnalyser

answered on Stack Overflow Oct 26, 2017 by marss19

User contributions licensed under CC BY-SA 3.0