On some machines, if you are using our Cloud Components, then you may get the following error as shown in Figure 1:
System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=126.96.36.199, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
Figure 1: Newtonsoft.Json.dll missing
This indicates that the Newtonsoft.Json.dll was not added to the .XAP file.
You can easily fix this by right-clicking on the project and selecting “Unload Project”, and then “Edit YOUR_APP_NAME.csproj”. From here you will see all the project properties as well as references included in your application. The only reference that you will want to update is the ones for Newtonsoft.Json as shown below.
<Reference Include="Newtonsoft.Json" Condition=" '$(Platform)' == 'ARM' ">
<Reference Include="Newtonsoft.Json" Condition=" '$(Platform)' == 'x86' ">
Here, we will fix the ARM and the x86 version by adding <Private>True</Private>.
The documentation states that the Private build property: Specifies whether the reference should be copied to the output folder.
Save the file and reload the project. You can now build and deploy the app to the emulator and you should not have that error.
Michael Crump is a Microsoft MVP, Pluralsight and MSDN author as well as an international speaker. He works at Telerik with a focus on everything mobile. You can follow him on Twitter at @mbcrump or keep up with his various blogs by visiting his Telerik Blog or his Personal Blog.