Saturday, September 6, 2014

EF5: Cannot attach the file ‘{0}' as database '{1}'

Go to View -> SQL Server Object Explorer and delete the database from the (localdb)\v11.0 subnode!

Delete the database

The model backing the context has changed since the database was created

Database.SetInitializer<YourDbContext>(null);
or


Database.SetInitializer(new DropCreateDatabaseIfModelChanges<YourDbContext>());
for later versions