Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xamarin portable library and Json.net

I am not able to use Json.net in the portable library. I set the portable library to use profile 4.5 -78. It compile fine but during runtime, it throws file not found exception. Any body encountered the same issue?

like image 500
user1331889 Avatar asked Feb 14 '23 15:02

user1331889


2 Answers

Nuget is probably adding a reference to the portable-net45+wp80+win8 portable assembly for Json.NET, which is incompatible with the current versions of Xamarin. To get things working you can manually switch the reference to use portable-net40+sl4+wp7+win8

Switching to compatible portable Json.NET reference

like image 69
Greg Shackles Avatar answered Feb 17 '23 04:02

Greg Shackles


I'm having the same issue with the newer Nuget package (Newtonsoft.Json.6.0.1). To solve the problem, I had to replace the HintPath in the PCL csproj with portable-net40+sl5+wp80+win8+monotouch+monoandroid.

For that, edit manually the csproj file, and locate this section:

<Reference Include="Newtonsoft.Json, Version=...">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\packages\Newtonsoft.Json.6.0.1\lib\portable-net45+wp80+win8\Newtonsoft.Json.dll</HintPath>
</Reference>

and adapt the path to the DLL.

like image 32
Tajomaru Avatar answered Feb 17 '23 04:02

Tajomaru