问题描述
我需要此软件包才能访问 Web.config
中的设置:
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 ==========
我已经看到其他人在网络核心应用程序中使用了此程序包,那么问题是什么?如何在.NET Core应用程序中使用它?
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?
推荐答案
如错误所述,您可以使用 System.Configuration.ConfigurationManager 仅从.NETCoreApp 2.0开始.对于以前的版本,您只有配置API .
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.
关于所提供的链接:请仔细阅读,并不表示ConfigurationManager`可用并且可以与早期版本的.NET Core一起使用.
Regarding a provided link: reread it carefully, it doesn't say that ConfigurationManager` is available and works with the previous version of .NET Core.
这篇关于无法将System.Configuration.ConfigurationManager添加到.NET Core应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!