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

If you delete the DB file, it still stays registered with SqlLocalDB. Sometimes it fixes it to delete the DB. You can do this from the command line.

  1. Open the “Developer Command Propmpt for VisualStudio” under your start/programs menu.
  2. Run the following commands:

    sqllocaldb.exe stop v11.0

    sqllocaldb.exe delete v11.0

Leave a Comment