刚刚接触.net core ,准备把以前的一些技术经常使用工具先移植到.net Standard上面来, 方便之后使用,结果用到ConfigurationManager 的 AppSettings 就出现各类问题web
首先是 app
错误 CS0012 类型“NameValueCollection”在未引用的程序集中定义。必须添加对程序集“System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”的引用。工具
考虑到.net Core 和 .net Standard 的跨平台性,System.dll 应该就不是获取的系统本地的,so 去Nuget 找找,而后过果断找到这个.net
Microsoft.NETCore.Portable.Compatiblity,其中包含一些系统级类库blog
但是结果仍是同样,而后继续百度各类资料,结果是。。。没有结果get
无奈只有翻*墙求助谷歌,结果让我找到这个it
参考资料io
https://www.danylkoweb.com/Blog/no-configurationmanager-in-aspnet-core-GCtable
Core 中获取AppSettings 的方式之一
https://colinmackay.scot/2016/07/03/application-configuration-in-net-core-part-1/