title: How to fix "'ServerVersion' threw an exception of type 'System.InvalidOperationException'"?
body: <p>I have got a local SQL Server DB, up and running, and I am trying to connect to it in a seemingly failproof way: </p>
  
  <pre><code>new SqlConnection(@"Server=(localdb)\v12.0;Integrated Security=true;Database=MyDBName;");
  </code></pre>
  
  <p>However, this line throws an exception:  "'ServerVersion' threw an exception of type 'System.InvalidOperationException'"? What could I do to fix it? </p>
  
  <p>I have run</p>
  
  <pre><code>sqllocaldb create "v12.0"
  </code></pre>
  
  <p>but it seems to make no difference.</p>
  
  <p><a href="https://i.stack.imgur.com/e1RR6.png" rel="noreferrer"><img src="https://i.stack.imgur.com/e1RR6.png" alt="enter image description here"></a> </p>
  
  <p><a href="https://i.stack.imgur.com/CIsLh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/CIsLh.png" alt="enter image description here"></a></p>