title: Read a connection string for web.config, app.config, & .NET Core json
body: <p>We have a library we provide to customers in a variety of uses on a variety of platforms. We are porting it to .NET Core 3.</p>
  
  <p>One of our methods allows them to pass in the name of a ConnectionString in the app.config or web.config file. I need to write this code so it runs in .NET Core (so no System.Web classes like WebConfigurationManager) and will read from the JSON config file.</p>
  
  <p>But it also needs to read from web.config or app.config if it is being used on .NET standard. So <a href="https://stackoverflow.com/questions/46996480/how-to-read-web-config-file-in-net-core-app">this answer</a> won't work.</p>
  
  <p>What is the best way to do this?</p>