neuecc / Utf8Json

Definitely Fastest and Zero Allocation JSON Serializer for C#(NET, .NET Core, Unity, Xamarin).
MIT License
2.36k stars 267 forks source link

Unable to target .NET 4.6 #183

Closed sgiovannini closed 4 years ago

sgiovannini commented 4 years ago

I'm using this for a custom log layout. The project I'm adding it to is developed in an older version of .NET (not exactly sure which one--third party and cannot modify it). The target machine runs .NET Framework 4.6.2. I get this error when trying to use it:

File name: 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' at Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify[T](IJsonFormatterResolver resolver) at Utf8Json.JsonSerializer.ToJsonString[T](T value, IJsonFormatterResolver resolver)

I cannot add .NET Standard support to the third-party product. Is there an older version of this library that will work here? If so, which one?

sgiovannini commented 4 years ago

I was able to resolve this issue by coyping the netstandard.dll from C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net461\lib. The target machine is running .NET 4.6.1. When I copied that next to the Utf8Json.dll file, the log4net plugin I wrote was able to function.