'local Database Runtime: Cannot Create Named Instance
Solution 1:
Purge by fire your computer of all non-SQL 2014 LocalDb or higher instances. As of this writing, I'm using the SQL-2014 version.
Make your EF connection xml in the App.Config look something like this.
<system.data.localdb><localdbinstances><addname="MyNamedInstance"version="12.0" /></localdbinstances></system.data.localdb><connectionStrings><addname="DiaProdConnection"connectionString="Data Source=(localdb)\MyNamedInstance;Initial Catalog=MovieDB;Integrated Security=True;AttachDbFilename=|DataDirectory|MovieDB.mdf"providerName="System.Data.SqlClient" /></connectionStrings>Many examples will have that field
|DataDirectory|in their connection string. Unfortunately, what they won't tell you is that that string isn't a special string known by the framework, but is instead a variable that you have to assign and set yourself. For that, I call this code at the entry point of my application.AppDomain.CurrentDomain.SetData("DataDirectory", Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData));
Keep in mind, that if the DB exists on the system but in a different location, the connector will throw an error.
Running
Sqllocaldb.exeiShould help you see if an instance exists and from there you can decide if it needs to be deleted.
I'm horrified by how poor the documentation is on the errors and how obnoxious the whole thing seemed.
Post a Comment for "'local Database Runtime: Cannot Create Named Instance"