Telerik blogs

Introduction

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=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.

error_wp

Figure 1: Newtonsoft.Json.dll missing

This indicates that the Newtonsoft.Json.dll was not added to the .XAP file.

The Fix

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' ">
 <HintPath>$(TelerikWP8Dir)\Binaries\WindowsPhone\ARM\Newtonsoft.Json.dll</HintPath>
 <Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json" Condition=" '$(Platform)' == 'x86' ">
 <HintPath>$(TelerikWP8Dir)\Binaries\WindowsPhone\x86\Newtonsoft.Json.dll</HintPath>
 <Private>True</Private>
</Reference>

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.


MichaelCrump
About the Author

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.

Comments

Comments are disabled in preview mode.