I am migrating the .netframework 4.7.2 class library to .netstandard 2.0 library.
ConfigurationManager is used in the .netframework class library to read the app settings.
Any alternative option available for the System.Configuration.ConfigurationManager in .netstanard.
The migrated class library needs to be used in a .net core web API and old .netframework web application.
ConfigurationManager was added to support ASP.NET Core's new WebApplication model, used for simplifying the ASP.NET Core startup code.
Right click the project and choose add reference, browse "Assemblies" and tick the System. Configuration assembly.
The ConfigurationManager class enables you to access machine, application, and user configuration information. This class replaces the ConfigurationSettings class, which is deprecated. For web applications, use the WebConfigurationManager class.
Application configuration in ASP.NET Core is performed using one or more configuration providers. Configuration providers read configuration data from key-value pairs using a variety of configuration sources: Settings files, such as appsettings. json.
ConfigurationManager is used in the .netframework class library to read the app settings. Any alternative option available for the System.Configuration.ConfigurationManager in .netstanard. The migrated class library needs to be used in a .net core web API and old .netframework web application.
It is not possible to create .NET Standard library which references System.Configuration.ConfigurationManager package and uses ConfigurationManager class. Once library adds reference to .NET Core specific package it ceases to be portable .NET Standard library since it is bound to framework specific package.
Namespace: System.Configuration. To use the ConfigurationManager class, your project must reference the System.Configuration assembly. By default, some project templates, like Console Application, do not reference this assembly so you must manually reference it. using System.Configuration; This class provides two properties:
You could install ConfigurationManager via nuget package, which targets .Net Standard 2.0. As for ASP.Net Core, have a look at Microsoft.Extensions.Configuration. As I said, you should not depend directly on how the configuration is obtained in a class library. Keep your class library flexible.
You could install ConfigurationManager
via nuget package, which targets .Net Standard 2.0.
As for ASP.Net Core, have a look at Microsoft.Extensions.Configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With