9
I am attempting to generate a code map using Visual Studio 2017 Enterprise, but receive the following error:
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:
- Installing SQL server components. Most of the SQL Server components one might find in the Visual Studio Installer are already installed:
-
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:
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:
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)
8
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:
- Locate the location of the SQL Server LocalDB utility. For me this is
"C:\Program Files\Microsoft SQL Server\130\Tools\Binn\SqlLocalDB.exe"
. - Open an admin shell in that folder.
SqlLocalDB.exe i
shows all database instances.- Delete the DB:
SqlLocalDB.exe d MSSQLLocalDB
If this fails, you may need to trySqlLocalDB.exe stop MSSQLLocalDB -k
first. - 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.
标签:Map,Code,Database,connection,Server,Visual,Studio,SQL,Microsoft From: https://www.cnblogs.com/yanglang/p/17174960.html