SqlException: Cannot attach the file xyz as database xyz

0

I'm unable to let EF6 create a new DB instance (i deleted the old one before). This is my connection string:

"Server=(LocalDb)\PasV4;AttachDbFilename='C:\Users\ME\AppData\Local\Temp\DBNAME.mdf';Integrated Security=true;Database=DBNAME"

Whenever I run Database.CreateIfNotExists(); this exception is thrown:

System.Data.SqlClient.SqlException HResult=0x80131904 Message=Cannot attach the file 'C:\Users\sebdau\AppData\Local\Temp\vma-devTest' as database 'vma-devTest'. Source=.Net SqlClient Data Provider StackTrace: at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

I've tried to update LocalDB to latest CU. When I connect to my LocalDB Instance manually, I can create the a new DB but then EF does not create the schema from the model.

Any advice?

Thanks, Seb

entity-framework-6
localdb
asked on Stack Overflow Nov 5, 2018 by sedau79

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0