Using a Nuget package (Json.Net)

I’m trying to use the Newtonsoft.Json (aka Json.Net) package in Unity.

I can add the package through Nuget in Visual Studio and I see a reference. When I switch back to Unity, I get a

error CS0103: The name `Newtonsoft' does not exist in the current context

And switching back to VS (and reloading the project) results in no reference.

The author’s site states that it’s 100% mono-compatible…

Run Anywhere
Json.NET supports Windows, Silverlight, Windows Phone, Mono, MonoTouch and MonoDroid.

So I’m wondering if Unity is just incapable of handling Nuget packages? If so, how can I get it to include the assembly? (I can get the DLL but where should I place it for Unity to find it/preserve a reference as appropriate?)

Thanks

Yes, Unity itself is incapable of handling Nuget packages, they’re more of a VS thing. But as long as the assembly targets .NET 2.0 you should be able to use the .dll in Unity without issue (I think you may have to change the Api Compatibility Level under File\Build Settings\Player Settings from .Net 2.0 Subset to the full .Net 2.0 depending on the assembly).

I’m pretty sure this is the version of Newtonsoft’s JSON that you’ll want to use. I don’t remember if a managed assembly needs to be in a specific place, I have mine in Assets\Plugins but it may not matter. You will likely have to manually add the reference in VS (unless you use UnityVS, which might do it automatically when generating the project).