I am using SQL Server 2014 Express and Visual Studio Community 2015.
When I used sqllocaldb i
to list all localdb instances in my PC, I can see 2 instances, e.g. MSSQLLocalDB and ProjectsV12. I can stop and delete an instance by using sqllocaldb stop MSSQLLocalDB
and sqllocaldb delete MSSQLLocalDB
.
Then I deleted the folder MSSQLLocalDB under AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\
, but when I run sqllocaldb i
again, both localdb instances still exist. The problem is that when I launch VS2015, the deleted folder will be re-generated!
How can I delete the localdb instance from my PC completely?
After you delete the instances like you have done with sqllocaldb
, check if the auto-generated .mdf file in the project that uses the localdb still has that file in the folder App_Data
and also make sure that you delete the correct database in the Server Explorer, i.e.:
<connectionStrings>
tag and check under AttachDBFilename
property which file is being generated (you can also alter the name of the file in here and in order to change it's name completely, you can modify the Data Source=(LocalDb)\ProjectsV12
field);App_Data
folder and in the top bar of the Solution Explorer click the Show All Files icon and then on the Refresh icon;sqllocaldb delete ProjectsV12
to make sure it's definitely deleted;Update-Database
in the Package Manager Console to regenerate the database (or the new instance, as you redefined in Web.Config).If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With