- Home /
Unity duplicate Newtonsoft dll issue with package cache
Getting the following error: "Multiple precompiled assemblies with the same name Newtonsoft.Json.dll included on the current platform. Only one assembly with the same name is allowed per platform. (/Library/PackageCache/com.unity.nuget.newtonsoft-json@2.0.0/Runtime/Newtonsoft.Json.dll)"
I have a specific version of Newtonsoft.json.dll that I'm using in my project, which isn't the one in the cache. I have no idea why that one is there, but I would like to get rid of it.
Things I've tried: Deleting the folder from PackageCache. This didn't work. Unity puts it back, even though I don't want it. Looking for it in package manager -> I couldn't find a reference to Newtonsoft anywhere. Removing my version -> as expected, everything breaks because I'm depending on that exact version being there.
This was not an issue in a 2021.1.5..something, I forget what's on my other computer. I'm currently importing this project into 2021.1.12f1.
It looks like something changed, and newtonsoft is required somewhere in the Unity internal piping, as I'm also getting this warning
The package cache was invalidated and rebuilt because the following immutable asset(s) were unexpectedly altered:
Packages/com.unity.nuget.newtonsoft-json/Tests/Editor
Packages/com.unity.nuget.newtonsoft-json/README.md
Packages/com.unity.nuget.newtonsoft-json/Runtime
Packages/com.unity.nuget.newtonsoft-json/CHANGELOG.md
Packages/com.unity.nuget.newtonsoft-json/Tests/Editor/Unity.Nuget.NewtonsoftJson.EditorTests.asmdef
Packages/com.unity.nuget.newtonsoft-json/LICENSE.md
Packages/com.unity.nuget.newtonsoft-json/Runtime/Newtonsoft.Json.dll
And this error:
Assembly 'Library/ScriptAssemblies/Unity.PlasticSCM.Editor.dll' will not be loaded due to errors:
Reference has errors 'unityplastic'.
If i am removing the Newtonsoft Json dlls from my assets folder then time i open the project unity will re-add that and repeat the issue. the worst is that you can't refference used newtonsoft assembly, because it's in package cache, to create some internal "map" and will bork on duplicate DLL names.
Answer by Tom-Red · Jun 24, 2021 at 10:00 AM
I just got this in my project as well, and it certainly looks like some version of Newtonsoft.Json was added to Unity in the 1.5.7 collab version. Very odd. My solution; since everything was broken in my project after updating was reverting the manifest.meta and whatever other editor-related changes first, then reverting the deletion of the Newtonsoft.Json.dll
Very strange that Unity's changelog for 1.5.7 collaboration doesn't state any changes to this at all. https://docs.unity3d.com/Packages/com.unity.collab-proxy@1.5/changelog/CHANGELOG.html