NuGet, PCLs, MVVMCross and Xamarin Studio 4.2.2

I'm trying to get NuGet to get the PCL assemblies for MVVMCross (and others if possible) but can't seem to get it working.

I'm using the NuGet addin (which hasn't been updated to NuGet 2.7.2 or Xamarin Studio 4.2.2), and I'm trying to add MVVMCross to a PCL project.

Here's the error it's returning:
"Could not install package 'MvvmCross.PortableSupport 3.0.14'. You are trying to install this package into a project that targets 'portable-net40+sl50+wp80+win+MonoAndroid10+MonoTouch10', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author."

Is this something wrong on the MVVMCross side? The addin side?

For the general case of using PCL libraries that are published on NuGet repositories, is this an issue I'm likely to run into repeatedly? For example, the beta gdata clients (http://www.nuget.org/packages/Google.GData.Client/) apparently support PCL, but I'm not sure how to install them.

How do other people work with MVVMCross?

Posts

  • GuillermoGutierrezGuillermoGutierrez ESMember ✭✭✭

    Sadly the NuGet addin doesn't support PCL projects yet. You can however add the DLL references manually from the downloaded package or (this is what I do right now) switch to a Windows machine and add them from NuGet for Visual Studio.

  • mattwardmattward GBMember Xamurai

    The latest version 0.7 of the NuGet addin for Xamarin Studio has partial support for PCL projects if you have Mono 3.2.3 or Mono 3.2.4 installed. What the addin does not currently support is adding a NuGet package with a PCL into a project that targets one of the Mono frameworks (e.g. MonoAndroid, MonoTouch). Which will hopefully be fixed when the addin is updated to NuGet 2.7.2.

    MvvmCross.Portable 3.0.14 has a PCL that supports

    portable-win+NET45+MonoAndroid+MonoTouch+sl40+wp71
    

    Based on reading the NuGet source code, in order to install MvvmCross.Portable into your project all the versions of the frameworks that the project targets need to be greater than or equal to the frameworks targeted by the PCL in the NuGet package.

    For your PCL project you have

    portable-net40+sl50+wp80+win+MonoAndroid10+MonoTouch10
    

    So I believe the problem is that the MvvmCross.Portable PCL requires .NET 4.5 but your project is targeting .NET 4.0 as part of the PCL profile.

    Now MvvmCross.Portable does have an assembly that targets MonoAndroid but I do not believe NuGet will use that unless your project is only targeting MonoAndroid. I do not think you can install a .NET 4.0 assembly into a PCL project that targets .NET 4.0 as part of its profile. Otherwise this other assembly could use part of the .NET 4.0 API that is not supported by another part of the PCL profile you are targeting.

  • JeffWard.8680JeffWard.8680 USUniversity ✭✭

    I actually got this working with a secondary NuGet repo, but it also required that I change the profile in the PCL project.

    I'm hoping that as PCL becomes more common more developers will look into adding the MonoAndroid10 and MonoTouch10 support to their PCLs.

    Thanks for the detailed reply!

  • MarwanMarwan USMember, University

    Haven't tried yet but Mvvmcross v3.1.1 beta just appeared today....

Sign In or Register to comment.