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.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

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
    villeHelin, Aurigan, ChrisVMC and 6 others like this.