我在.NET Standard库中同时使用ServiceStack和System.Configuration.ConfigurationManager包。我特别引用了ConfigurationErrorsException
类。我的 Visual Studio 无法生成,因为它不知道ConfigurationErrorsException
来自哪个程序集。
dotnet 团队已将System.Configuration
命名空间移植到 netcore,所以也许现在是时候将其从 ServiceStack 程序集中删除了?
来源参考资料
ServiceStack 中的 System.Configuration 命名空间:https://github.com/ServiceStack/ServiceStack/blob/0b84a5a638d4230e6211eba554796980fcdc1f3b/src/ServiceStack/Platforms/PlatformNetCore.cs
System.Configuration.ConfigurationManager 软件包:https://www.nuget.org/packages/System.Configuration.ConfigurationManager/
System.Configuration.ConfigurationManager 软件包中的 ConfigurationErrorsException 源:https://github.com/dotnet/corefx/blob/a10890f4ffe0fadf090c922578ba0e606ebdd16c/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationErrorsException.cs
解决方法
我已经通过别名ServiceStack程序集有一个解决方法:https://github.com/NuGet/Home/issues/4989#issuecomment-310565840,但这似乎很hack。
请求
如果从ServiceStack网络标准库中删除System.Configuration命名空间以及ConfigurationErrorsException类,那就太好了。
我已将其移至此提交中的ServiceStack
命名空间。
此更改从 v5.5.1 开始提供,现在可在 MyGet 上使用。