After migrating from .NET Core 2.1 to .NET Core 3.1, publish has a problem

Viewed 3630

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.

2 Answers

I resolved the problem after remove the tag <RuntimeIdentifier> from the publish profile.

@@Morteza install System.Runtime.CompilerServices.Unsafe version 6.0.0 from NuGet into your project.

Install-Package System.Runtime.CompilerServices.Unsafe -Version 6.0.0
Related