MSBuildForUnity icon indicating copy to clipboard operation
MSBuildForUnity copied to clipboard

Multiple precompiled assemblies on Newtonsoft

Open rrowlands opened this issue 2 years ago • 1 comments

The core scenario number 1 is failing for me with the following errors:

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. (E:/dev/projects/odokonia/unity/Library/PackageCache/[email protected]/Runtime/Newtonsoft.Json.dll)
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. (Assets/Dependencies/netstandard2.1/Newtonsoft.Json.dll)

I am guessing that this is due to the fact that Newtonsoft is now included by default in Unity and thus cannot be imported as a dependency using MsBuild?

rrowlands avatar Jun 15 '23 13:06 rrowlands

What version of Unity are you using? I had similar problem, but I had to just delete com.unity.nuget.newtonsoft-json package from manifest.json file. There is still issue that there is separate dependency graph for Unity Package Manager and MsBuildForUnity.

There is also a problem with importing packages that have dependency on NuGets, each package is resolved separately and they are generating separate folders with DLLs which is causing conflicts for me as well.

I still didn't find any way of resolving this even manually by disabling selected indirect dependencies in NuGets or in Unity packages.

Maybe a good idea would be to use packages-lock.json to at least verify what is already there, but on the other hand those are completely different packages and I think it will need to just check what files are there.

RoswellCityUK avatar Jul 07 '23 09:07 RoswellCityUK