SYSLIB0017: Strong-name signing is not supported and throws PlatformNotSupportedException

The following APIS are marked as obsolete, starting in .NET 6. Using them in code generates warning SYSLIB0017 at compile time. These APIs throw a PlatformNotSupportedException at run time.

For more information, see https://github.com/dotnet/runtime/issues/50529.

Workarounds

None.

Suppress a warning

If you must use the obsolete APIs, you can suppress the warning in code or in your project file.

To suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the warning.

// Disable the warning.
#pragma warning disable SYSLIB0017

// Code that uses obsolete API.
// ...

// Re-enable the warning.
#pragma warning restore SYSLIB0017

To suppress all the SYSLIB0017 warnings in your project, add a <NoWarn> property to your project file.

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
   ...
   <NoWarn>$(NoWarn);SYSLIB0017</NoWarn>
  </PropertyGroup>
</Project>

For more information, see Suppress warnings.