How to fix the “error 2025: XML Schema validation failed for mapping schema.” error

by Steve French in Entity Framework on June 4, 2013

The Problem

You’ve been upgrading and downgrading Entity Framework, and just when everything seems to be working, you get an error of

Schema specified is not valid. Errors:
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The ‘http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem’ attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The ‘http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem’ attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The ‘http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem’ attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The ‘http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem’ attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The ‘http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem’ attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The ‘http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem’ attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The ‘http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem’ attribute is not declared.

The Cause

The data migrations have gotten out of sync

The Solution

The solution (use at your own risk)

  1. Delete the migrations folder and
  2. Drop the _MigrationHistory table in the database
  3. Run Enable-migrations -Force in the package manager console
  4. Add a migration
  5. Check the migration file that is created – it should have a listing of your entire database – delete the table creation and dropping code
  6. run update-database -verbose

You should be back in business!