Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Dependency On Newtonsoft.Json

Discussion in 'Unity Remote Config' started by BBB_brunoma, Jan 22, 2020.

  1. BBB_brunoma

    BBB_brunoma

    Joined:
    Jan 10, 2017
    Posts:
    21
    Hi guys,
    I noticed the latest version (1.1.0 preview) has a dependency on JSON.NET.
    I have a third party plugin that I am currently using that depends on an older version of JSON.NET, and updating to the latest version of Remote Config causes it to fail to load.

    It looks like a possible way to resolve this in a Visual Studio is to use dependency redirects in the app config, but I can't seem to figure out how to do this in unity or if it is even possible?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    What plugin is causing the issue? Have you contacted them?
     
  3. BBB_brunoma

    BBB_brunoma

    Joined:
    Jan 10, 2017
    Posts:
    21
    I think I figured out the solution. Posting it here for anybody who has the same problem

    1) Add the line:

    Code (CSharp):
    1. -appconfig:app.config
    to the csc.rsp file

    2) Create a file called "app.config" in the root of your project (above assets folder)
    with this in it:

    Code (CSharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <configuration>
    3.   <runtime>
    4.     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    5.       <dependentAssembly>
    6.         <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    7.         <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
    8.       </dependentAssembly>
    9.     </assemblyBinding>
    10.   </runtime>
    11. </configuration>
    This will redirect any plugin that depend on an older version of JSON.NET (0-12) to use the newer version included with Remote Config (com.unity.nuget.newtonsoft-json 2.0.0-preview)

    In my case, I was using Google APIs in my editor tools & Google.Apis.Core depends on JSON.Net v10.
     
    Last edited: Jan 22, 2020
    p0w1nd, villeHelin, Aurigan and 7 others like this.