Is ConfigurationManager.AppSettings available in .NET Core 2.0?

前端 未结 5 1735
孤街浪徒
孤街浪徒 2020-11-29 01:05

I\'ve got a method that reads settings from my config file like this:

var value = ConfigurationManager.AppSettings[key];

It compiles fine

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-29 01:41

    I installed System.Configuration.ConfigurationManager from Nuget into my .net core 2.2 application.

    I then reference using System.Configuration;

    Next, I changed

    WebConfigurationManager.AppSettings
    
    to ..
    
    ConfigurationManager.AppSettings
    

    So far I believe this is correct. 4.5.0 is typical with .net core 2.2

    I have not had any issues with this.

提交回复
热议问题