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?
答案 0 :(得分:2)
删除像sqllocaldb
一样的实例后,检查项目中使用localdb的自动生成的 .mdf 文件是否仍然在文件夹{ {1}}并确保在服务器资源管理器中删除正确的数据库,即:
App_Data
标记,并在<connectionStrings>
属性下检查正在生成哪个文件(您也可以在此处更改文件的名称为了完全更改它的名称,您可以修改AttachDBFilename
字段); Data Source=(LocalDb)\ProjectsV12
文件夹,然后在解决方案资源管理器的顶部栏中单击显示所有文件图标,然后单击刷新 icon; App_Data
确保它已被删除; sqllocaldb delete ProjectsV12
重新生成数据库(或在 Web.Config 中重新定义的新实例)。