PC002: API not available in .NET Framework 4.6.1
You're calling an API in .NET Standard that isn't available in the .NET Framework 4.6.1.
While the .NET Framework 4.6.1 is treated by NuGet as implementing .NET Standard 2.0, it doesn't fully implement it. This trade-off is explained in the .NET Standard specification.
How to fix violations
You cannot reasonably guard your code against missing APIs. You only have two options:
- Not call the affected API.
- Not run your code on .NET Framework 4.6.1.
When to suppress warnings
Unless you stop calling the API entirely, you have to suppress this warning as shown in the following example:
using System.Diagnostics.CodeAnalysis; [assembly: SuppressMessage("Usage", "PC002:API not available in .NET Framework 4.6.1", Justification = "This library will not run on .NET Framework 4.6.1")]