【问题标题】:Can't restore packages on macOS Sierra无法在 macOS Sierra 上恢复包
【发布时间】:2017-04-10 17:13:59
【问题描述】:

我正在尝试使用 .NET CORE 和 VSCode 在 Mac 上创建一个基本的 Web 应用程序 [没有成员资格和授权]。

使用

创建新项目后
yo aspnet

命令我正在尝试恢复我的应用程序文件夹中的包,但我收到此错误:

log  : Restoring packages for /Users/<user_name>/<app_name>/project.json...
error: Unable to load the service index for source https://api.nuget.org/v3/index.json.
error:   The type initializer for 'System.Net.Http.CurlHandler' threw an exception.
error:   The type initializer for 'Http' threw an exception.
error:   The type initializer for 'HttpInitializer' threw an exception.
error:   The type initializer for 'CryptoInitializer' threw an exception.
error:   Unable to load DLL 'System.Security.Cryptography.Native.OpenSsl': The specified module could not be found.
error:    (Exception from HRESULT: 0x8007007E)
Done: 1.

(我已经安装了所有依赖项和工具来在 mac 上执行 ASP.NET)

【问题讨论】:

  • 删除该项目并首先使用dotnet new 创建一个用于测试的项目。过时的模板通常会导致错误。您还应该在此类问题中包含 dotnet --version 的输出,以便人们知道您使用的是哪个版本的 SDK。
  • 您说您安装了工具,但您是否也安装了运行时只是为了确定? Unable to load DLL 'System.Security.Cryptography.Native.OpenSsl': The specified module could not be found 听起来更像是.NET Core 运行时没有正确安装
  • 您是否按照.NET Core download page 中关于安装 OpenSSL 和创建符号链接的说明进行操作?

标签: asp.net-core nuget visual-studio-code .net-core macos-sierra


【解决方案1】:

您没有按照https://www.microsoft.com/net/core#macos 教程中的说明安装 OpenSSL,运行以下命令应该可以解决问题。

brew update; brew install openssl; mkdir -p /usr/local/lib; ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/; ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/;

在我的电脑中,如果我卸载 OpenSSL,也会发生同样的错误。

【讨论】:

    猜你喜欢
    • 2017-03-24
    • 2017-04-19
    • 2017-06-16
    • 1970-01-01
    • 1970-01-01
    • 2017-01-29
    • 2017-06-02
    • 2017-01-30
    • 2017-08-19
    相关资源
    最近更新 更多