0

I've been running into an issue recently when I attempt any tutorials that involve using a SQL database, entity framework, dapper, etc.

When it comes time to publish a database, or utilize an ORM, I'm given duplicate options for the same localdb under SQL Servers. Furthermore, then I attempt to publish, the database doesn't show up under the localdb that I've chosen.

I'm wondering how I go about removing the other SQL Servers and just having the one available.

If you look at the image below, the Browse option gives me two of the same LocalDbs. Plus I also get a 3rd one under \ProjectModels. I'm wondering what's causing this and how it can be fixed since no matter which one I choose, the sql database I attempt to publish doesn't show up within any of them.

enter image description here

Amit Joshi
  • 15,448
  • 21
  • 77
  • 141
ACDev
  • 139
  • 3
  • 11

1 Answers1

0

My advice is not to use this method to publish the database. (right click to delete)

Please refer to this official documentation.

File-based databases like SQLite or SQL Server Express are designed to store their data in easily transferable files that can be served with your application/site.

"Copy to Output Directory" Property of the database file to "Copy if newer". Just point the address to it.

If you are using a server-based database like SQL Server, MySQL, etc., you need to make sure that the target machine/environment has the same database server installed, and you need to write a deployment script to append the pre-populated data files to the server. This might be troublesome for you.

You can also refer to these links. 1,2,3

Jiale Xue - MSFT
  • 3,560
  • 1
  • 6
  • 21