title: Getting Connection Strings from App.Config
body: <p>In .Net Framework 4.7.2 I use:</p>
  <pre><code>Public Shared Connection As New MySqlConnection(ConfigurationManager.ConnectionStrings(&quot;Project.My.MySettings.ConnString&quot;).ConnectionString)
  </code></pre>
  <p>To get my connection string.</p>
  <p>However, now I'm using .Net 5.0 and it's throwing me the following two errors:</p>
  <p><strong>ConfigurationErrorsException: Configuration system failed to initialize</strong></p>
  <p><strong>ConfigurationErrorsException: Unrecognized configuration section system.diagnostics.</strong></p>
  <p>My App.Config was Auto generated and looks like this:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
  &lt;configuration&gt;
      &lt;configSections&gt;
      &lt;/configSections&gt;
      &lt;connectionStrings&gt;
          &lt;add name=&quot;Project.My.MySettings.ConnString&quot; connectionString=&quot;server=0.0.0.0;userid=rice;password=password;database=db;&quot; /&gt;
      &lt;/connectionStrings&gt;
      &lt;system.diagnostics&gt;
          &lt;sources&gt;
              &lt;!-- This section defines the logging configuration for My.Application.Log --&gt;
              &lt;source name=&quot;DefaultSource&quot; switchName=&quot;DefaultSwitch&quot;&gt;
                  &lt;listeners&gt;
                      &lt;add name=&quot;FileLog&quot;/&gt;
                      &lt;!-- Uncomment the below section to write to the Application Event Log --&gt;
                      &lt;!--&lt;add name=&quot;EventLog&quot;/&gt;--&gt;
                  &lt;/listeners&gt;
              &lt;/source&gt;
          &lt;/sources&gt;
          &lt;switches&gt;
              &lt;add name=&quot;DefaultSwitch&quot; value=&quot;Information&quot; /&gt;
          &lt;/switches&gt;
          &lt;sharedListeners&gt;
              &lt;add name=&quot;FileLog&quot;
                   type=&quot;Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f, processorArchitecture=MSIL&quot;
                   initializeData=&quot;FileLogWriter&quot;/&gt;
              &lt;!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log --&gt;
              &lt;!--&lt;add name=&quot;EventLog&quot; type=&quot;System.Diagnostics.EventLogTraceListener&quot; initializeData=&quot;APPLICATION_NAME&quot;/&gt; --&gt;
          &lt;/sharedListeners&gt;
      &lt;/system.diagnostics&gt;
  &lt;/configuration&gt;
  </code></pre>