【发布时间】:2018-02-01 09:38:11
【问题描述】:
除了安装 .net core SDK 并使用 dotnet run 之外,我无法在 ubuntu14.04 上执行我的 C# .Net Core 2.0 应用程序。该应用程序使用导致问题的 log4net 2.0.8。当我在 WIndows 10 上使用 dotnet publish -c Release -r ubuntu.14.04-x64 打包它时,会出现很多错误,例如:
error NU1605: Detected package downgrade: System.Runtime.Extensions from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version.
...
error NU1605: Detected package downgrade: System.Runtime.InteropServices from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version.
直接引用这些包不会改变任何东西,但在 linux 下打包它是有效的。但是,当我使用 ./maypp 执行打包的应用程序时,我得到:
Unhandled Exception: System.ArgumentNullException: SafeHandle cannot be null.
Parameter name: pHandle
at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument, ExceptionResource resource)
at System.StubHelpers.StubHelpers.SafeHandleAddRef(SafeHandle pHandle, Boolean& success)
at Interop.GlobalizationInterop.GetSortKey(SafeSortHandle sortHandle, String str, Int32 strLength, Byte* sortKey, Int32 sortKeyLength, CompareOptions options)
at System.Globalization.CompareInfo.GetHashCodeOfStringCore(String source, CompareOptions options, Boolean forceRandomizedHashing, Int64 additionalEntropy)
at System.Linq.Set1.InternalGetHashCode(TElement value)
at System.Linq.Set1.Add(TElement value)
at System.Linq.Set1.UnionWith(IEnumerable1 other)
at System.Linq.Enumerable.DistinctIterator1.FillSet()
at System.Linq.Enumerable.DistinctIterator1.ToArray()
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
没有 log4net 它可以工作。谷歌没有透露任何提示。欢迎任何想法?
【问题讨论】:
-
您是否引用了
Microsoft.AspNetCore.All和Microsoft.NetCore.App两个包?我有与此相关的非常相似的问题,因为不应直接引用Microsoft.NetCore.App。因此,我有一些版本不匹配,看起来完全一样。此处描述的问题也导致我的情况类似github.com/aspnet/IISIntegration/issues/476
标签: linq .net-core ubuntu-14.04 log4net globalization