0

I installed nuget package System.Security.Cryptography.Primitives 4.3.0, I'm using Visual Studio 2017, NETStandard.Library 2.0.3 Target framework is netstandard2.0

Where is CryptographicOperations?

CryptographicOperations

maraaaaaaaa
  • 7,749
  • 2
  • 22
  • 37
  • Are you sure this exists? I can't find anything about it. – Nathalia Soragge Jul 16 '18 at 03:50
  • Yes, it's in all the "what's new" announcements for net core 2.1, https://blogs.msdn.microsoft.com/dotnet/2018/05/30/announcing-net-core-2-1/ – maraaaaaaaa Jul 16 '18 at 03:56
  • https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-2-1 – maraaaaaaaa Jul 16 '18 at 03:56
  • 1
    *Target framework is `netstandard2.0`*, but your links says that it was introduced in .NET Core 2.1. The same in the [documentation](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.cryptographicoperations?view=netcore-2.1#applies-to) for `CryptographicOperations` class. – user4003407 Jul 16 '18 at 04:26

1 Answers1

2

What I found...

  • I was able to use this without issue when targeting .Net Core 2.1
  • The API surface area doesn't include this static class for .Net Standard 2.0

This makes me think you are under the assumption that .Net Standard has equal API access to .Net Core, but this is not the case. There is generally a trade-off when targeting .Net Standard, allowing for more compatibility, but giving up some API access.

How do I target .Net Core 2.1?

  • You can download the appropriate SDK at this link
  • Ensure you use the correct version for your operating system x86 or x64.
  • You can open the command prompt and run this command to confirm:
    • dotnet --list-sdk
  • This should output the list of installed SDKs for .NET including:
    • 2.1.302 [INSTALL_LOCATION] (At the time of writing this, this is the current version)
  • Once installed you can open Visual Studio 2017, open or create a .Net Core targeted application or class library, then change to the appropriate target under:
    • Project → SOLUTION_NAME Properties... → Target framework:

My answer to your question:

The static class, CryptographicOperations, is located in System.Security.Cryptography.Primitives for .Net Core 2.1

aaronedmistone
  • 929
  • 10
  • 17