Any insights are appreciated on how to enable this scenario in 2018.1. The primary reason why I am using 2018.1 is to leverage the use of .NET Standard 2.0.
Similar in that it’s the same error message but the root cause might be different, especially since I have been able to use Newtonsoft JSON.NET successfully in Unity 5.x and 2017.x. The main difference is that I bring in a .NET 4.5 version for Unity Editor + Mono/.NET standalone support, and a WSA version for UWP. Our MRTK actually uses that plugin in the default package. Here the problem stems from using a single .NET Standard version for all platforms since it’s supposed to be supported in Unity 2018.1.
My custom library is a .NET Standard 2.0 library and it needs to stay like that since it is to be used with a variety of .NET modules, including Xamarin, UWP+XAML, UWP+Unity (for MR), desktop .NET/Mono, and server-side ASP.NET. Yes I have successfully used Newtonsoft JSON.NET as a .NET 4.5 plugin in Unity 5.x and 2017.x, but now I need it to work with .NET Standard 2.0. That’s specifically why I am trying 2018.1 beta, otherwise I’d still be in 2017.2.
Thanks, good suggestion but no dice. It still complains about Newtonsoft.Json.dll, and I also tried with the latest 2018.1.0b8. This is the #1 Nuget package worldwide, hopefully this gets resolved soon since it’s definitely not a fringe scenario.
FYI, it now works in Unity 2018.1.0b9. I made sure to select IL2CPP as my scripting backend. That said, since my .NET Standard 2.0 DLL also has a dependency on Newtonsoft JSON.NET (which was causing the issue), I also switched to the newly released v11 of JSON.NET since it now includes a .NET Standard 2.0 DLL (previous was v1.3). All seems good now. I will report back if I find net standard 2.0 scenarios that break.
Which DLL did you pick? First, download the latest v11 of Json.net. When you unzip the Nuget package, use the DLL in the net standard 2.0 DLL. You also need to use IL2CPP. Unity was clear that net standard won’t work with the .NET Scripting backend.