Cannot access LocalDb from Visual Studio 2015 Community Edition


Today I was trying to spin up a quick Web API for an angular project I’m working on in a fresh install of Visual Studio 2015 using Entity Framework Code First.  Unfortunately after creating a simple model, when I tried to update-database to make sure all the moving parts were in a good state I was seeing the following error:

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: 50 – Local Database Runtime error occurred. The specified LocalDB instance does not exist.)

After some investigation and questioning of whether LocalDB was installed (it was).  I discovered this error is caused by the connection string created by Entity Framework targeting an instance called MSSQLLocalDB which won’t exist.  I believe the error occurs because VS 2015 sees that LocalDB is already installed during installation and therefore doesn’t create this new instance on install.  The fix is to simply replace the instance name of MSSQLLocalDB with v11.0 in DefaultConnection in web.config.


Visual Studio 2010 Pro Power Tools


For anyone who’s moved across to Visual Studio 2010 I highly recommend taking a look at the online gallery of extensions under Tools -> Extension Manager.

Even at this early point in the products release there are some excellent extensions available. In particular Pro Power Tools. This adds various productivity enhancements of which the most awesome is the search feature added to the Add Reference dialog.

Go check them out. But careful, it’s difficult to stop once you start! 🙂