Could not load file or assembly System.Runtime.CompilerServices.Unsafe

i fix it comenting in web.config the entry that contains System.Runtime.CompilerServices.Unsafe


I had the same problem with unity container and after updated this dll from Nuget my problem solved


Try it in CMD,

you can find gacutil in(C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools>), and other installed frameworks in bin folder, try runs same commands for other '..\bin\NETFX x.x Tools' frameworks if necessary

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools>

gacutil -i "C:\Program Files\dotnet\sdk\3.1.401\Sdks\Microsoft.NET.Sdk.WindowsDesktop\tools\net472\System.Runtime.CompilerServices.Unsafe.dll"