title: ConnectionString in app.Config not working
body: <p>In my winform project I have a connection string to connect to SQL. I have this connection in app.config file like this;</p>
  
  <pre><code> &lt;connectionStrings&gt;
    &lt;add name="MyConnectionString" providerName="System.Data.SqlClient"
          connectionString="Server=(localdb)\\v11.0; Integrated Security=true; AttachDbFileName=C:\\Folder\\mydataBaseName.mdf;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False" 
     /&gt;
  </code></pre>
  
  <p> </p>
  
  <p>and I get the connection:</p>
  
  <pre><code>string config = ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString;
  //and then
   using (SqlConnection conexao = new SqlConnection(config))
          {
              conexao.Open();
           .......
           .......
          }
  </code></pre>
  
  <p>When I run the app I get an error saying : "An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll"</p>
  
  <p>But If I call the connection string directlly from code (not using the app.config) everthing is ok .</p>
  
  <pre><code>string config = "Server=(localdb)\\v11.0; Integrated Security=true; AttachDbFileName=C:\\Folder\\mydataBaseName.mdf;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False";
  </code></pre>
  
  <p>Any ideias, how to solve the problem ? </p>
  
  <p>Thanks Leonor</p>