After migrating my project from .NET Core 2.1 to .NET Core 3.1, everything works fine but when publishing the project, Iget this error:
System.Runtime.CompilerServices.Unsafe doesn't support netcoreapp3.1. Consider updating your TargetFramework to netcoreapp3.1 or later.