[Mono-list] The imported type `Newtonsoft.Json.JsonConvert' is defined multiple times

Daniel Hughes trampster at gmail.com
Mon May 18 05:24:53 UTC 2015


At work we are tying to convert a windows service to run on linux
using mono. We have run into the following error:

Error CS0433: The imported type `Newtonsoft.Json.JsonConvert' is
defined multiple times (CS0433)

It appears that in mono System.Net.Http.Formatting.dll includes
Newtonsoft. Seeing as we are reference this as well as the actually
Newtonsoft we end up with a conflict.

It is clearly wrong for System.net.Http.Formatting to exposes
Newtonsoft as a public API. Essentially breaking every application
trying to use Newtonsoft.

This is captured as a bug here:
https://bugzilla.xamarin.com/show_bug.cgi?id=23668

Now given that we can't wait for it to be fixed, released, packaged
and then a new ubuntu to come out that includes it (> 6 months event
if fixed today) what work around can people suggest?

On linux we could remove the reference to Newtonsoft and use the one
built into the System.Net.Http.Formatting, however if we do this then
we will need different project files for .net/mono which is not very
attractive to say the least.

Is there some way we can instruct the mono compiler to use the one
from the Newtonsoft assembly in order to resolve this conflict?

Cheers,
Daniel Hughes


More information about the Mono-list mailing list