C# .Net Core读取AppSettings

1.右击项目添加应用程序配置文件

 2.通过NuGet包管理器,添加System.Configuration.ConfigurationManager包

 

 3. 在App.config添加 appSettings节点

  <appSettings>
    <add key="YourKey" value="YourValue"/>
  </appSettings>

4. 在程序中读取配置文件

System.Configuration.ConfigurationManager.AppSettings["YourKey"]

原文地址:https://www.cnblogs.com/YourDirection/p/14062254.html