1053
Views
14
Comments
Multiple version of Newtonsoft.Json assembly
Question

Hello everybody I have a wrong assembly version problem. I have an extension which internally uses Dropbox.Api.dll dll and this in turn uses Newtonsoft.Json inernamente. In an isolated project extension it works perfectly, but when used in a project of mine that has other extensions that use Newtonsoft.Json get an error as if using the wrong version of Newsoft.Json dll. How can I force the platform to use the correct version of the dll Newtonsoft.Json?

2012-03-16 12-21-09
João Rosado
Staff

Hi Alexandre,

Up to version 9.1 you need to make sure all your extensions use a consistent version in all your extensions. Also note that the platform REST APIs also uses newtonsoft json 5.0.8, so if you module has a REST API the platform will force that version regardless of what is included in extensions.

In version 10, the newtonsoft is included in all applications regadless of REST usage (a version 8.0.x I think, not sure). Integration studio also distributes the dll automatically to prevent multiple versions in extensions and a configuration is added to the applications web.config to force the version used by the platform.


In what version are you having issues?


Regards,
João Rosado

UserImage.jpg
João Inácio

João Rosado wrote:

Hi Alexandre,

Up to version 9.1 you need to make sure all your extensions use a consistent version in all your extensions. Also note that the platform REST APIs also uses newtonsoft json 5.0.8, so if you module has a REST API the platform will force that version regardless of what is included in extensions.

In version 10, the newtonsoft is included in all applications regadless of REST usage (a version 8.0.x I think, not sure). Integration studio also distributes the dll automatically to prevent multiple versions in extensions and a configuration is added to the applications web.config to force the version used by the platform.


In what version are you having issues?


Regards,
João Rosado


Hi João,

You said : "also distributes the dll automatically to prevent multiple versions in extensions"

Since the platform includes Newtonsoft.Json dll, its recommended not to include it on the references of the visual studio project?

In the need of using it on a project, how is could it be referenced? (I mean " using OutSystems.. ; " what is the correct path to referencing it )


Thanks in advanced.

João Inácio


2025-10-21 13-42-45
Alexandre Costa

Hello João thanks for answer I'm using this DLL

https://www.nuget.org/packages/Dropbox.Api/

The version is 

I have a integration with Dropbox using .NET SDK. The Dropbox component of forge(official version) use API V1 that need oAuth but I need integrate using access token because I won't have a human interface to make an oAuth authorization.

2012-03-16 12-21-09
João Rosado
Staff

Actually I was referring the version of OutSystems, so I could try to make a solution suggestion. 


Also, can you paste here the error you get?


2025-10-21 13-42-45
Alexandre Costa

Hi João thanks again, I use version 9.1.501.0 of the platform I add the message that i receive.


erronewtonjson.png
2012-03-16 12-21-09
João Rosado
Staff

Hi Alexandre,


Ok, so the method that is failing was introduced around 5.0.x of NewtonSoft.Json ...so what I recommend you is to use the 5.0.8 version in your extensions (since that is the version that you will be forced to use if any of your applications have a REST in them).


To do a quick test if that would work correctly (as they can be more methods in use that changed between 5.0.x and 7.0.x) just open your module and add a REST API to it (anything will do, like a rest call to https://www.google.com/ )
That till make the platform force it's 5.0.8 assembly to be included.


Regards,
João Rosado


2025-10-21 13-42-45
Alexandre Costa

João Rosado wrote:

Hi Alexandre,


Ok, so the method that is failing was introduced around 5.0.x of NewtonSoft.Json ...so what I recommend you is to use the 5.0.8 version in your extensions (since that is the version that you will be forced to use if any of your applications have a REST in them).


To do a quick test if that would work correctly (as they can be more methods in use that changed between 5.0.x and 7.0.x) just open your module and add a REST API to it (anything will do, like a rest call to https://www.google.com/ )
That till make the platform force it's 5.0.8 assembly to be included.


Regards,
João Rosado


Hello João thanks for repply, later I will test and I tell you here if work.  My application was stopped and as production was I made a workaround that was exposed web service methods rest on an isolated module where the extension worked perfectly and the other modules consume call this REST.


2012-03-16 12-21-09
João Rosado
Staff

Hi João,

Sorry, only noticed your reply now.


When you open your extension in Integration Studio and compile it a version of the library will be automatically placed on the \Bin directory of our extension.

You can reference it from there. Note that the version will be different on each platform major version, so I recommend setting in Visual Studio the "Specific Version" property of the reference set to "False" to prevent errors during future upgrades.


Regards,
João Rosado

2019-11-12 17-31-26
Justin James
 
MVP

This is what is known as "DLL" or "JAR" Hell (depending on your platform version). In summary, you have included a version of a DLL or JAR in your project that another Extension, or the Platform itself, has ALSO included, but a different version. This can get ugly quickly. In addition to Joao's suggestion, you MUST go into your Extension, find the DLL in "Resources" tab, and tell it to "Exclude from Extension" (right click it) to keep the DLL out of the server's file system and polluting everything else.

J.Ja

2019-10-27 01-32-56
Caio Santana Magalhães
 
MVP

Guys,


And what if I want to use a method that was made available in a version later than the one forced by the platform when having REST services?


Here's the error I'm getting


Method not found: 'Void Newtonsoft.Json.Linq.JToken.AddAnnotation(System.Object)'.


And here's the DLL signature during runtime


Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed


Any suggestions?

2019-10-27 01-32-56
Caio Santana Magalhães
 
MVP

Luckly, the Newtonsoft.Json lib is opensource.


I somehow managed to solve it by downloading a newer release from their repository (https://github.com/JamesNK/Newtonsoft.Json/releases), changed its assembly name and namespaces (like "{ModuleName}Newtonsoft.Json"), compiled it, referenced it in my project and there yo go! No conflicting problems.

2019-11-12 17-31-26
Justin James
 
MVP

Caio Santana Magalhães wrote:

Luckly, the Newtonsoft.Json lib is opensource.


I somehow managed to solve it by downloading a newer release from their repository (https://github.com/JamesNK/Newtonsoft.Json/releases), changed its assembly name and namespaces (like "{ModuleName}Newtonsoft.Json"), compiled it, referenced it in my project and there yo go! No conflicting problems.

Yes, this was what I was in the middle of typing. ;)

J.Ja

2019-10-27 01-32-56
Caio Santana Magalhães
 
MVP

Ugly workaround, but it works.

2018-06-21 17-15-45
Sérgio Dias
Staff

When editing the extension in Visual Studio, try including the Newtonsoft.Json.dll reference from the Integration Studio folder (eg.: C:\Program Files\OutSystems\Development Environment 11\Integration Studio) 

Worked for me.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.