0

The main project is in .NET Core 1.1 I added a reference to a project in .NET Framework 4.7 but I get this error :

You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

In the .NET Framework project I use RNGCryptoServiceProvider not available in .NETStandard.

How can I do ?

TheBoubou
  • 19,487
  • 54
  • 148
  • 236

2 Answers2

1

You cannot use .NET Framework 4.7 libraries in a .NET Core 1.1 application.

Regarding RNGCryptoServiceProvider, this type will be part of .NET Core 2.0 and .NET Standard 2.0 so you can use the code that uses it in a .NET Standard 2.0 library (instead of .NET Framework) and use it in a .NET Core 2.0 application.

Martin Ullrich
  • 94,744
  • 25
  • 252
  • 217
1

If you want to do something like this (.NET)

using (var csprng = new RNGCryptoServiceProvider())
  csprng.GetBytes(24);

You can do something like this (in .NETStandard)

var randomNumberGenerator = RandomNumberGenerator.Create();
randomNumberGenerator.GetBytes(24);
TheBoubou
  • 19,487
  • 54
  • 148
  • 236