Search code examples
asp.net-corenugetvisual-studio-code.net-coremacos-sierra

Can't restore packages on macOS Sierra


I'm trying to create a Web Application Basic [without Membership and Authorization] on Mac using .NET CORE and VSCode.

After creating a new project using

yo aspnet

command I'm trying to restore packages in my app folder but I get this error:

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.

(I've already installed all dependencies and tools to execute ASP.NET on mac)


Solution

  • You did not install the OpenSSL as described in the tutorial at https://www.microsoft.com/net/core#macos, running the command below should resolve the issue.

    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/;
    

    In my computer, if I uninstall the OpenSSL, the same error happens.