Forum Visual Studio

Error using nuget


I'm currently evaluating Xamarin as well as Xamarin Studio for my company.

The first thing I did was creating a project structure containing a PCL. Within this PCL, I tried to install autofac using nuget, but that's simply not possible.
Console output:

Could not install package 'System.Runtime.InteropServices.RuntimeInformation 4.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', 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.

I did some research. The error seems to be somewhat related to nuget as well as to the portable .NET library (as the error message suggests, but see also, for example) rather than to autofac itself.

Is this a known issue? Should I use a newer version of NuGet from within the Terminal to install dependencies in the future?

Best Answers


  • mattwardmattward GBMember Xamurai

    This does not look like a Xamarin Studio problem. Visual Studio 2015 with NuGet 3.5 reports the same error.

    Looking at the NuGet package whilst it has a .NET Standard 1.1 assembly in a ref folder it does not have a .NET Standard 1.1 assembly in the lib so NuGet considers the package to not be compatible with the PCL profile. Profile 111 supports .NET Standard 1.1.

  • FlyshewoorstFlyshewoorst DEMember ✭✭
    edited October 2016

    Thanks for your answer.

    I kind of guessed that. Installing and referencing autofac manually seems to work. I still just wonder if am the first one around here who is confronted with this behaviour/error; autofac is not the only lib that causes it.

    Who's fault is it eventually, who should know about this? I can only find a few results on the internet searching for this error message. The oldest entry is from 2015.

  • FlyshewoorstFlyshewoorst DEMember ✭✭


    great! Thank you very much!

    Do I need to add the project.json to the PCL root dir?

  • mattwardmattward GBMember Xamurai
    edited October 2016

    Add it to the same directory that your PCL project's .csproj file is in.

  • FlyshewoorstFlyshewoorst DEMember ✭✭

    Thanks for your support. Really appreciate it. Will test it in a few hours.

  • FlyshewoorstFlyshewoorst DEMember ✭✭

    A big thanks to you!

  • DepechieDepechie BEInsider, Developer Group Leader ✭✭

    @BenjaminPettit his answer is the correct one! It's an issue with the order of adding the nuget packages!

  • RobertHendenRobertHenden USMember ✭✭

    Thanks @moke, your fix worked for me.

  • sajidhsajidh USMember

    I got it working with the following steps

    Delete the packages folder from the project
    add a new row to the packages config file with the package name
    clean and build

  • franciscotenafranciscotena USMember

    Thanks @moke!

  • ChristophHuberChristophHuber USMember ✭✭
    edited July 2017

    For me the error was caused by different nuget versions (nuget update). A solution cleanup is not enough you have to remove all "obj" and bin "folders". As @sajidh mentioned deleting the packages folder was not necessary.

  • JassimRahmaJassimRahma USMember ✭✭✭✭

    none solved my problem :(

Sign In or Register to comment.