Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot build or migrate database after update to AspNet Identity version 2

Having updated from a working version 2 beta to the RC of AspNet.Identity (core and EF) I now get an error when trying to run my project or migrate the database.

This is the error I get in package manager console when I try and add a migration:

 PM> Add-Migration IdentityUpdate
 System.Data.Entity.Core.MetadataException: Schema specified is not valid. Errors: 
 (0,0) : error 0004: Could not load file or assembly 'Microsoft.AspNet.Identity.EntityFramework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
 at System.Data.Entity.Core.Metadata.Edm.EdmItemCollection.LoadItems(IEnumerable1 xmlReaders, IEnumerable1 sourceFilePaths, SchemaDataModelOption dataModelOption, DbProviderManifest providerManifest, ItemCollection itemCollection, Boolean throwOnError)
 at System.Data.Entity.Core.Metadata.Edm.EdmItemCollection.Init(IEnumerable1 xmlReaders, IEnumerable1 filePaths, Boolean throwOnError)
 at System.Data.Entity.Core.Metadata.Edm.EdmItemCollection..ctor(IEnumerable1 xmlReaders)
 at System.Data.Entity.Utilities.XDocumentExtensions.GetStorageMappingItemCollection(XDocument model, DbProviderInfo& providerInfo)
 at System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff(XDocument sourceModel, XDocument targetModel, Lazy1 modificationCommandTreeGenerator, MigrationSqlGenerator migrationSqlGenerator, String sourceModelVersion, String targetModelVersion)
 at System.Data.Entity.Migrations.DbMigrator.Scaffold(String migrationName, String namespace, Boolean ignoreChanges)
 at System.Data.Entity.Migrations.Design.MigrationScaffolder.Scaffold(String migrationName, Boolean ignoreChanges)
 at System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Scaffold(MigrationScaffolder scaffolder)
 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)
Schema specified is not valid. Errors: 
 (0,0) : error 0004: Could not load file or assembly 'Microsoft.AspNet.Identity.EntityFramework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I now cannot run my project and don't know how to fix it. I can't find any reference to 'Microsoft.AspNet.Identity.EntityFramework, Version=1.0.0.0' anywhere in my solution.

like image 712
MIP1983 Avatar asked Mar 23 '14 19:03

MIP1983


1 Answers

I fixed this by adding the following to my web.config file:

<dependentAssembly>
        <assemblyIdentity name="Microsoft.AspNet.Identity.EntityFramework" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
like image 142
MIP1983 Avatar answered Oct 02 '22 07:10

MIP1983



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!