gpt4 book ai didi

.net - macOS 中的 dotnet 核心 : "The type initializer for ' Crypto' threw an exception"

转载 作者:行者123 更新时间:2023-12-02 01:47:54 25 4
gpt4 key购买 nike

我按照 .NET Core website 上的说明进行操作,但出现此错误。显然缺少一些先决条件。知道如何安装它们吗?

mymac:~ naveen.vijay$ dotnet new

Unhandled Exception: System.TypeInitializationException: The type initializer for 'Crypto' threw an exception. ---> System.TypeInitializationException: The type initializer for 'CryptoInitializer' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'System.Security.Cryptography.Native': The specified module could not be found.
(Exception from HRESULT: 0x8007007E)
at Interop.CryptoInitializer.EnsureOpenSslInitialized()
at Interop.CryptoInitializer..cctor()
--- End of inner exception stack trace ---
at Interop.Crypto..cctor()
--- End of inner exception stack trace ---
at Interop.Crypto.GetRandomBytes(Byte* buf, Int32 num)
at System.IO.Path.GetCryptoRandomBytes(Byte* bytes, Int32 byteCount)
at System.IO.Path.GetRandomFileName()
at Microsoft.DotNet.InternalAbstractions.TemporaryDirectory..ctor()
at Microsoft.Extensions.EnvironmentAbstractions.DirectoryWrapper.CreateTemporaryDirectory()
at Microsoft.DotNet.Configurer.NuGetPackagesArchiver..ctor()
at Microsoft.DotNet.Cli.Program.ConfigureDotNetForFirstTimeUse(INuGetCacheSentinel nugetCacheSentinel)
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)
at Microsoft.DotNet.Cli.Program.Main(String[] args)
Abort trap: 6

最佳答案

macOS 的安装说明已过时。请参阅 Github 上的讨论:SSL Fails to Link Using Brew .

我在 macOS El Capitan 上安装 .NET Core 时遇到了这个问题。解决方案,来自this answer ,正在运行以下命令:

sudo install_name_tool -add_rpath /usr/local/opt/openssl/lib /usr/local/share/dotnet/shared/Microsoft.NETCore.App/1.0.0/System.Security.Cryptography.Native.dylib

在我的终端中运行该命令后,dotnet new 工作正常。

关于.net - macOS 中的 dotnet 核心 : "The type initializer for ' Crypto' threw an exception",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39133356/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com