System.Net.Http from Nuget being Overwritten

TonyValentiTonyValenti Tony ValentiUSMember ✭✭

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/4.0.0.0__b03f5f7f11d50a3a/System.Net.Http.dll

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

Answers

  • ChrisHamonsChrisHamons Chris Hamons 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 Tony Valenti 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 (3.8.0.49 - 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 3.8.0.49 (d15-4: 09806627)
    Selected target framework: .NETFramework,Version=v4.5; API: Unified
    /Library/Frameworks/Mono.framework/Commands/pkg-config --variable=prefix mono-2
    /Library/Frameworks/Mono.framework/Versions/5.4.0/lib/pkgconfig/../..
    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/4.0.0.0__b03f5f7f11d50a3a/System.Net.Http.dll

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

  • ChrisHamonsChrisHamons Chris Hamons 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/4.0.0.0__b03f5f7f11d50a3a/System.Net.Http.dll
    

    A few questions / ideas:

    • Are you on Mono 5.4.0.201 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 (https://jenkins.mono-project.com/view/Xamarin.MaciOS/job/xamarin-macios-builds-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 Tony Valenti 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 Tony Valenti USMember ✭✭

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

  • TonyValentiTonyValenti Tony Valenti USMember ✭✭

    @ChrisHamons -
    Any ideas?

  • ChrisHamonsChrisHamons Chris Hamons USXamarin Team Xamurai

    Responded directly via a direct message, as I had feedback on multiple issues in the solution.

    For public/historical reference, the problem was the csproj was referencing the library with a standard

    <Reference Include="System.Net.Http" />
    

    and did not have a hint path. This meant we resolved against the BCL, either GAC on system or Full BCL when I moved to the supported Full target framework.

    Adding a hint path to the nuget fixed things.

Sign In or Register to comment.