sdk: dotnet restore failing with "Unable to load DLL 'System.Security.Cryptography.Native'" on macosx

Steps to reproduce

/temp/hwapp$ dotnet new /temp/hwapp$ dotnet restore log : Restoring packages for /Users/xxx/temp/hwapp/project.json… error: The type initializer for ‘Crypto’ threw an exception. error: Unable to load DLL ‘System.Security.Cryptography.Native’: The specified module could not be found. error: (Exception from HRESULT: 0x8007007E)

Expected behavior

I expected to get no error while restoring packages.

Actual behavior

Getting the error below while restoring packages: error: The type initializer for ‘Crypto’ threw an exception. error: Unable to load DLL ‘System.Security.Cryptography.Native’: The specified module could not be found. error: (Exception from HRESULT: 0x8007007E)

Environment data

dotnet --info output:

/temp/hwapp$ dotnet --info
Unknown option: --info
.NET Command Line Tools (1.0.0-beta-001598)
Usage: dotnet [common-options] [command] [arguments]

Arguments:
  [command]     The command to execute
  [arguments]   Arguments to pass to the command

Common Options (passed before the command):
  -v|--verbose  Enable verbose output
  --version     Display .NET CLI Version Info

Common Commands:
  new           Initialize a basic .NET project
  restore       Restore dependencies specified in the .NET project
  build         Builds a .NET project
  publish       Publishes a .NET project for deployment (including the runtime)
  run           Compiles and immediately executes a .NET project
  repl          Launch an interactive session (read, eval, print, loop)
  pack          Creates a NuGet package

Operating system: Darwin mak 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64

Installed OpenSSL with macports:

>sudo port installed | grep openssl
  openssl @1.0.1j_0+universal
  openssl @1.0.1k_0+universal
  openssl @1.0.2_0+universal
  openssl @1.0.2a_0+universal
  openssl @1.0.2d_0+universal
  openssl @1.0.2e_0+universal
  openssl @1.0.2f_0+universal
  openssl @1.0.2g_0+universal
  openssl @1.0.2g_0 (active)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 22 (7 by maintainers)

Commits related to this issue

Most upvoted comments

@nicc777 it doesn’t work for me… When i run this command i get brew link --force openssl Warning: Refusing to link: openssl Linking keg-only OpenSSL means you may end up linking against the insecure, deprecated system version while using the headers from the Homebrew version. Instead, pass the full include/library paths to your compiler e.g.: -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib

The recent change to homebrew is something that we’re trying to follow up on.

@nicc777 I have the same problem as @lokinfey and @sleemer.

Remember to run brew link --force openssl