title: How to add LocalDB to Visual Studio 2015 Community's SQL Server Object Explorer?
body: <h3>Problem</h3>
  <p>I don't understand how to make LocalDB show up in the SQL Server Object Explorer. On some VMs, it shows up automatically, on some other VMs, it doesn't. Still, after googling for hours, I don't get it.</p>
  <h3>Current situation</h3>
  <ol>
  <li>I have a clean VM</li>
  <li>I installed Visual Studio 2015 Community (all default settings)</li>
  <li>I let a console application run (Entity Framework 6, code-first, console application) which worked on another VM and created a database automatically which then showed up in the SQL Server Object Explorer; but not this time</li>
  </ol>
  <p>The error says:</p>
  <pre><code>System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.) ---&gt; System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
  </code></pre>
  <p>So, on this VM, no database gets created and nothing shows up in the SQL Server Object Explorer's <code>SQL Server</code> node.</p>
  <p><a href="https://i.stack.imgur.com/NsZiq.png" rel="noreferrer"><img src="https://i.stack.imgur.com/NsZiq.png" alt="Connecting to LocalDB" /></a></p>
  <h3>What I think to know</h3>
  <ul>
  <li>Visual Studio 2015 Community comes with LocalDB; so everything should just work out of the box, but it doesn't, and I don't know why</li>
  <li>LocalDB databases are just a pair of files (*.mdf and *.ldf)</li>
  <li>I've seen the files being created at the default database location at <code>C:\Users\&lt;username&gt;\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\MSSQLLocalDB</code>; but on this VM, there is no such folder</li>
  <li>The <code>App.config</code> looked every time like this (and it was automatically created that way when I installed Entity Framework 6 the NuGet Package Manager in Visual Studio):</li>
  </ul>
  <h3>App.config</h3>
  <pre><code>&lt;configuration&gt;
    &lt;configSections&gt;
      &lt;section name=&quot;entityFramework&quot; type=&quot;System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&quot; requirePermission=&quot;false&quot; /&gt;
  &lt;/configSections&gt;
    &lt;entityFramework&gt;
      &lt;defaultConnectionFactory type=&quot;System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework&quot;&gt;
        &lt;parameters&gt;
          &lt;parameter value=&quot;mssqllocaldb&quot; /&gt;
        &lt;/parameters&gt;
      &lt;/defaultConnectionFactory&gt;
      &lt;providers&gt;
        &lt;provider invariantName=&quot;System.Data.SqlClient&quot; type=&quot;System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer&quot; /&gt;
      &lt;/providers&gt;
    &lt;/entityFramework&gt;
  &lt;/configuration&gt;
  </code></pre>
  <h3>Other random comments</h3>
  <ul>
  <li>Earlier, with SQL Server, it was necessary to open up certain ports, but LocalDB runs, as I understand it, as a separate process on demand when started by Visual Studio.</li>
  <li>I don't know how to debug the <code>SQLException</code></li>
  <li>Does LocalDB not come packaged with Visual Studio 2015 Community and do I need to install it separately?</li>
  </ul>