I need this package to access settings in the Web.config
:
Restoring packages for D:\ ... path ... \dozor-backend.csproj...
Package System.Configuration.ConfigurationManager 4.4.0 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package System.Configuration.ConfigurationManager 4.4.0 supports:
- net461 (.NETFramework,Version=v4.6.1)
- netstandard2.0 (.NETStandard,Version=v2.0)
Package restore failed. Rolling back package changes for 'dozor-backend'.
Time Elapsed: 00:00:01.0720066
========== Finished ==========
I've seen other people use this package in net core app, so what's the issue? How can I use it in .NET Core app?
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.
As error said, you can use System.Configuration.ConfigurationManager only starting from .NETCoreApp 2.0. For the previous version, you only have new ASP.NET Core configuration mechanism provided by Configuration API.
Settings files, such as appsettings.json New .NET console applications created using dotnet new or Visual Studio by default do not expose configuration capabilities. To add configuration in a new .NET console application, add a package reference to Microsoft.Extensions.Hosting. Modify the Program.cs file to match the following code:
The project is on the .NET Core 3.0 with System.Configuration.ConfigurationManager NuGet package installed. It works on the previous version which is on the .NET Core 2.2 so no idea why it is not working on 3.0? The code behind the reference for creating the database context is using Entity Framework, which is supposed to be supported in 3.0?
Just to be clear here: System.Configuration.ConfigurationManager is not part of .NETStandard2.0. It's a package you're referencing. That package has to provide different implementations since in some cases it's providing an implementation and in other cases it's forwarding to existing desktop types.
As error said, you can use System.Configuration.ConfigurationManager only starting from .NETCoreApp 2.0. For the previous version, you only have new ASP.NET Core configuration mechanism provided by Configuration API.
Regarding a provided link: reread it carefully, it doesn't say that ConfigurationManager` is available and works with the previous version of .NET Core.
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