20
votes

After installing Visual Studio 2017 with the SQL Server Data tools feature checked, I noticed LocalDB was not installed. How can I add SQL Server LocalDB 2016 to my Visual Studio 2017 installation? Did I miss a checkbox when installing VS2017, or is it simply not included with the installer? If so, how do I configure VS2017 so I can view and connect to my manually installed LocalDB database in Visual Studio's server browser?

9
Add it as an optional componentErikEJ
I have similar problem, local db is isntalled but cannot found inside Visual Studio 2017.gvd
@ErikEJ I can't find the option in the Visual Studio installer.Rudey

9 Answers

26
votes

It's automatically installed if .NET Desktop Development is checked. You can check it in the Summary. Visual Studio 2017 installation wizard

20
votes

SQL Server Express 2016 LocalDB is in .NET desktop development. If you missed it to select while installing Visual Studio 2017, you can select and install it later.

To install SQL Server Express 2016 LocalDB, go to Start in your Windows OS, type Visual Studio Installer and run it. Then click Modify. It will open the Workloads selection screen where you can select .Net desktop development. .Net desktop development includes SQL Server Express 2016 LocalDB. After selecting, click Modify and you are done.

But although you select .NET desktop development, it may not install. Because SQL Server 2016 or later is not supported for many processors. To check this, visit Hardware and Software Requirements for Installing SQL Server If this is your case, then you have to depend on SQL Server Express 2014 LocalDB or previous.

To install SQL Server Express 2014 LocalDB manually, download the installer from Microsoft® SQL Server® 2014 Service Pack 2 (SP2) Express and install SQL Server Express 2014 LocalDB by running the installer.

To connect to LocalDB, open Server Explorer in Visual Studio, right-click on Data Connections-> Add Connection. Enter Server name: (localdb)\MSSQLLocalDB and Test Connection. If test is success, click OK and you are now connected.

6
votes

It is a component under the .NET desktop development workload.

4
votes

As others have pointed out, LocalDB is automatically included if you select certain workloads, such as Desktop or ASP.Net.

However, you may not want one of those workloads. You may just want to add LocalDB.

In the Visual Studio Installer, navigate away from the Workloads tab to the second tab (Individual components). Here, the individual items are listed alphabetically, and can be selected or deselected for installation:

enter image description here

3
votes

New to the conversation, but wanted to share what I ran into because it may not be apparent that localdb was installed already. Here's another step you can take to verify.

I ran into this same issue and found out that I'd already installed localdb via desktop.

I was getting a connection string error and thought I did something wrong, but what I ended up doing is opening the SQL Server Object Explorer from within Visual Studio and sure enough, it was there.

Shortcut, Ctrl+\ & Ctrl+S, or View -> SQL Server Object Explorer.

2
votes

If you choose

ASP.NET and web development

then the option

SQL Server Express 2016 LocalDB

will also be checked and installed.

1
votes

I have the same issue here, I followed the accepted answer but I think nothing has been installed. I followed the installer, and everything was checked ever since I installed my Visual Studio 2017 Professional Edition:

enter image description here

enter image description here

After all successful installation, and tried to modify it again using the installer, it will show the that I need to download the same tools which I installed multiple times. In other words, I have the same window as my image I showed above even though I already installed and modified it several times. And LocalDb still is not yet installed.

So I directly downloaded it here, you can even choose your own version: SQL Server Express LocalDB

Then upon successful installation using the link above, I was now able to confirm that LocalDb has finally installed on my machine.

enter image description here

enter image description here

To query, run command prompt and input:

enter image description here

enter image description here

0
votes

I know this is a little different that what is asked, but the symptom is similar so I'm posting this. I figured out what I was missing. I was following a tutorial on Pluralsight, Bethany's Pie Shop, "Building Your First ASP.NET Core 2.0 MVC Application VS 2017", and tried running the solution downloaded. I had a failed login message... I re-watched a couple of the videos. This is what I was missing. I needed (in VS) to go to View->other windows->PkgMgrConsole - Make sure you've built the application (build solution at top of VS) - in console at bottom.... add-migration InitialMigration - in console.... update-database - run program

The person asking this didn't say how he got to the point that he thought he didn't have localDb installed. I checked, and I had it installed, but it was giving me a failed login message when I tried running the program without these steps.

0
votes

If you use Visual Studio Installer and select only .Net desktop development,it will uninstall all workloads you had before. It's a lengthy process beware.