& Construction

Integrated BIM tools, including Revit, AutoCAD, and Civil 3D
& Manufacturing

Professional CAD/CAM tools built on Inventor and AutoCAD
Integrated BIM tools, including Revit, AutoCAD, and Civil 3D
Professional CAD/CAM tools built on Inventor and AutoCAD
I would like to see if anyone else has experienced difficulty with running an addin that references a newer version of an assembly that Revit itself already uses as a dependency?
Because of data management needs in my application, I would like to use Newtonsoft.Json version 12.0.3. However, when I run the debugger, I observe that by the time my addin has loaded, it has already bound to version 9.00.1.19813.
I can only assume the reason for this is that Revit 2020 already references a 2016 version of Newtonsoft.json, as shown in the program files and indicated by the debugger. As a result, none of the traditional fixes or remedies for alternate assembly binding appear to work. Even creating a Directory.Build.props file and setting the MSBuild properties
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
does not seem to resolve the reference to the latest version. It still throws an exception indicating that it has bound to version 9. As a result, I cannot get the functionality I need because it didn't exist in version 9.
Has anyone else encountered this problem or a similar scenario (screenshots attached for clarity)?
Solved! Go to Solution.
Sorry. I know this is a can of worms - and an old one too. Jeremy, I believe your link to the CefSharp DLL entanglement solution using IPC solution is recursively self-pointing? GNU anybody? I've been spinning through more links than I can keep count off and haven't found an actual guide to getting this solved.
I also would like to load a modern version of Newtonsoft.Json (>11) in Revit 2020. How do I accomplish this?
Kind regards, Gregor
Gregor,
I have this issue on the shelf for right now because I was able to find an alternate approach that works with only the abilities contained within Newtonsoft version 9. I've looked through some of the content Jeremy linked but to me the issue is not truly solved yet.
If you feel like looking into this dark hole, you could think about one of the "nuclear options" that I was considering. If I'm not mistaken, you should be able to manually load the specific desired assembly and invoke its types and methods manually using System.Reflection. By any definition this is a truly brute force approach and I have not tried it myself specifically on Newtonsoft. However, I do use reflection frequently both inside my main app and in my testing environment where I want to reflect commands without locking the assembly on disk.
Ah. These things sort of linger with me and I have difficulties letting go. So I kind of kept at it and eventually fixed it - yay!
My addin uses GraphQL for .NET which requires and includes in its nuget package Newtonsoft 10.0.3 (soo close, right?)
Some of the references Jeremy included suggest to "build 2 class library projects" - the Revit addin, and another class library project that references the modern stuff. So I ripped the GraphQL stuff out of my addin, and moved the functionality into a helper class library. The hand-over between the 2 projects are plain objects - so the addin has no clue about GraphQL or that there are Newtonsoft versions outside the Smithsonian.
At this time this feels like a lot of duct-tape, but with a bit of rework this might be a legit way to go about this.
Hope this helps.
Cheers, Gregor
Makes sense. At that point, you're basically building your own wrapper so that you can reference in the functionality without the main addin even knowing that Newtonsoft is involved. Therefore no version conflict.
If your project is already reasonably compartmentalized, then this is actually far more pleasant than some of the other options.
The IPC for disentanglement link should be this:
How to buy
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © 2025 Autodesk Inc. All rights reserved
Type a product name