NuGet issue with PCL

I'm having issues with a PCL class library which I am attempting to share between an iOS and Android application.

The iOS version was developed first, using Xamarin Studio on a Mac, and is running fine (release to the App Store etc). The Android version is currently under development, using Visual Studio 2015 on Windows 10, and references the same PCL project.

When I pulled the shared project from Git it initially failed to build because the Json.NET didn't seem to want to restore - so I did it manually (removed and re-added) and all appeared well. However, when I pushed the project back to Git my Jenkins CI reported that the iOS version of the app was broken - the Json.NET component could not be found!

Looking at the packages.config file for the shared project I can see that the referenced package required to get each of the projects to build is different:

iOS
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="portable45-net45+win8+wp8" />

Android
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="portable-net45+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10" />

The question is, why the difference and how do I proceed?

Tagged:

Best Answers

Answers

  • DaveCarsonDaveCarson GBUniversity ✭✭✭

    Thanks for the feedback @mattward - looks like I may have gone down a blind alley with the packages.config.

    Looking at the .csproj file for the PCL I can see the following changes:

    iOS
    <HintPath>..\packages\Newtonsoft.Json.8.0.2\lib\portable-net45+wp80+win8+wpa81+dnxcore50\Newtonsoft.Json.dll</HintPath>

    Android
    <HintPath>..\[projectname].Droid\packages\Newtonsoft.Json.8.0.2\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>

    Looks like I will need to have a look at the project structure as it seems like there is a mismatch there.

  • DaveCarsonDaveCarson GBUniversity ✭✭✭

    I think you've nailed it with the .csproj reference - I'll review the project structure later today and feedback.

    Thanks for the input, really helpful

Sign In or Register to comment.