System.Net.Http from Nuget being Overwritten

TonyValentiTonyValenti USMember ✭✭

Hi All,
I have a project that references the latest version of System.Net.Http from nuget.

When I build my project, it appears as though my version of the DLL is not being used and is being replaced by a Mono one:
Added assembly /Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/gac/System.Net.Http/

What do I need to do to make sure that I use the System.Net.Http DLL from nuget and keep this from happening?

Best Answer


  • ChrisHamonsChrisHamons USXamarin Team Xamurai
    • What Target Framework are you using?
    • What Xamarin.Mac are you using?
    • Can you post a full build log?

    We've made a significant number of improvements to our netstandard / facade story in the latest build in Alpha/Beta channel, so consider trying that.

  • TonyValentiTonyValenti USMember ✭✭

    Thanks @ChrisHamons -
    I just upgraded to the latest alpha but that didn't fix it. I've got my build log attached.

    I'm using .NET 4.7.
    It looks like I'm using the latest version of xamarin.mac ( - at least it is the "current" folder).

    When I do the build, it looks like this line is where things are going wonky:
    Xamarin.Mac (d15-4: 09806627)
    Selected target framework: .NETFramework,Version=v4.5; API: Unified
    /Library/Frameworks/Mono.framework/Commands/pkg-config --variable=prefix mono-2
    MMP : warning MM1501: Can not resolve reference: /Library/Frameworks/Mono.framework/Versions/5.4.0/lib/mono/4.5/System.Runtime.InteropServices.RuntimeInformation.dll
    Added assembly /Library/Frameworks/Mono.framework/Versions/5.4.0/lib/mono/gac/System.Net.Http/

    Any ideas on what I need to do to make VS not copy in that file?

  • ChrisHamonsChrisHamons USXamarin Team Xamurai

    Are you using the "System" Target Framework?

    Selected target framework: .NETFramework,Version=v4.5; API: Unified

    There is a reason it's marked as not supported. It does not get the QA testing that other parts of XM get.

    It looks like we're not getting the assembly passed to mmp and are resolving from the GAC.

    Added assembly /Library/Frameworks/Mono.framework/Versions/5.4.0/lib/mono/gac/System.Net.Http/

    A few questions / ideas:

    • Are you on Mono also from Alpha/Beta? System mono pulls most of it's behavior from the system mono (since that is what you asked for).
    • Can you test with the XM from master ( and report back? We've made some improvements with netstandard for 4.5 there that might help
    • Can you build with msbuild set to diagnostic verbosity and "-v -v -v -v -v" in additional mmp arguments (Project Build Options -> Mac Build) and post the log?
    • Can you provide a sample showing the issue I can build locally?
  • TonyValentiTonyValenti USMember ✭✭

    Hi Chris,
    I tried changing things a bit and was not able to make it work.
    I just added "chamons" as a collaborator on a github repository that will demonstrate the issue. Open the AlphaDrive.Mac solution. The projects build fine and most show the right output, but when the AlphaDrive.App package builds, it has a 116kb System.Net.Http in the bundle instead of the correct one which is about 200kb.

  • TonyValentiTonyValenti USMember ✭✭

    @ChrisHamons - Meant to tag you in the response above.

  • TonyValentiTonyValenti USMember ✭✭

    @ChrisHamons -
    Any ideas?

Sign In or Register to comment.