Cannot attach the file 'test.mdf' as test database in MVC
If you're doing code-first migrations in ASP.Net MVC and you get the foloowing error Message
Cannot attach the file 'food.mdf' as food database in MVC
 
The Solution:
If you delete the DB file, it is still registered with SqlLocalDB.

Open the "Developer Command Propmpt for VisualStudio ( any version) 
under your "Start/Programs menu->All Programs->Visual Studio 2012->Visual Studio Tools"

Follow these steps:

1) sqllocaldb.exe which stop v11.0
2) sqllocaldb.exe which  deletes v11.0
3) execute "update-database" command from package manager console  to create database
   Author: Keyvan Janghrobani
   Category: asp.net
   Likes: 0
   Date Published: 10/24/2013 10:49:00 AM
   Hits: 2978
   Source:
   Share:

Write Comment
Your Name:
 
Email
Display Email
Comment  
Enter words in box:
Comments