skip to Main Content

I am attempting to generate a code map using Visual Studio 2017 Enterprise, but receive the following error:

enter image description here

Note the data source: Data Source=(LocalDB)MSSQLLocalDB. When I search for MSSQLLocalDB in my solution, nothing comes up. My application does not use SQL Server 2016 (which is what I think the connection string is for). It uses 2012. All my connection strings use (localdb)v11.0.

Fixes I’ve attempted / notes:

  • I have tried to view the XML file, but "Open the XML Editor" simply closes the .dgml file in Visual Studio.
  • Changing Visual Studio’s data connection (Tools -> Options -> Database Tools -> Data Connections) does not work:

enter image description here

  • Installing SQL server components. Most of the SQL Server components one might find in the Visual Studio Installer are already installed:

enter image description here

  • Visual Studio is up to date:
    enter image description here

  • I have seen this issue. Not only is that problem for VS2012, the solutions are for web.config. My app is a desktop app, so no web.config. But none of the projects’ app.config contain a reference to (LocalDB)MSSQLLocalDB anyway.

  • Thinking that it might have to do with the latest version of SSDT (15.8.1) no longer supporting SQL Server 2012, I checked the version. It is 15.1.6:
    enter image description here

Visual Studio is running on Windows 7 Ultimate, SP1, 64-bit.

EDITS

I am using SQL Server express with Local DB.

The issue does not appear to be related to connection strings. Following basic instructions for creating an SSDT project (here), and importing the database (noting that in step 6 I target SQL Server 2012), the issue still remains – no connection strings, and no actual code.

I have also verified that SQL Server 2012 is the only connected server:
enter image description here

Error message added for SEO purpose (the question was not findable on search engines)

The XML content in this document cannot be viewed as a graph because it contains unexpected errors. Open the XML Editor to fix these errors and then try re-opening the graph. The actual error found is described below. Unable to connect to the specified database. An exception occurred attempting to connect to a database using the following connection string : Data Source=(LocalDB)MSSQLLocalDB : Attach DbFilename=;Initial Catalog=master Integrated Security=True;Enlist=False;Asynchronous Processing=True; MultipleActive ResultSets=True Connect Timeout=30. Check that the specified SQL Server instance exists and the service is running. Call Stack : at Microsoft.Repository.SqlInteraction. OpenAndConfigureConnection (SqlConnection connection) Microsoft.Repository.SqlInteraction.<>c__DisplayClass7_0.<UsingConnection>b_0 () at at Microsoft.Repository.SqlInteraction.ExecuteRepositoryAction (Action action) at Microsoft.Repository.SqlInteraction. UsingConnection (SqlConnection sqlConnection, Action`1 act) at Microsoft.Repository.SqlInteraction. UsingMasterConnection (String connectionString, Action`1 act) at Microsoft. Repository. Utilities.GetDbStateAndFileNames (SqlConnectionStringBuilder builder) at Microsoft.Repository. Utilities.GetDatabase State (String connectionString) at Microsoft.VisualStudio. Architecture Tools. Progressive Reveal. PRUtilities. CanQuery (ActionContext context, IProgressionCacheSettings settings) at Microsoft.VisualStudio. ArchitectureTools. Progressive Reveal.GetRepositoryTimestamps Command.Execute (ActionContext context, IGraphStatus status Reporter, IProgressionCacheSettings settings) at Microsoft.VisualStudio. Architecture Tools. ProgressiveReveal. Progressive RevealProvider. GetRepositoryTimestampsHandler (ActionContext context) at Microsoft.VisualStudio. Progression. ActionManager. CallNormalActions (Action action, ActionContext actionContext, Boolean propagateCancellation)

2

Answers


  1. I had the same issue with VS 2019. My solution was to delete and recreate the database MSSQLLocalDB. The cause was probably that my account didn’t have rights to open the DB, maybe because my admin installed Visual Studio with his account.

    Here the steps to recreate the DB:

    1. Locate the location of the SQL Server LocalDB utility.
      For me this is "C:Program FilesMicrosoft SQL Server130ToolsBinnSqlLocalDB.exe".
    2. Open an admin shell in that folder.
    3. SqlLocalDB.exe i shows all database instances.
    4. Delete the DB: SqlLocalDB.exe d MSSQLLocalDB
      If this fails, you may need to try SqlLocalDB.exe stop MSSQLLocalDB -k first.
    5. Recreate the DB: SqlLocalDB.exe c MSSQLLocalDB

    Now I can use VS code maps and I can open the DB in the SQL Server Object Explorer in VS.

    Login or Signup to reply.
  2. For me the solution was to delete folder c:Usersu1AppDataLocalMicrosoftMicrosoft SQL Server Local DBInstancesMSSQLLocalDB (stop ‘sqlservr.exe’ that locks this folder) – and it will be re-created (answer). Looks like this folder (or some file in it) was created by elevated process and neither VS nor sqllocaldb.exe can access it.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search