Want to use System.Net.Http but not able to include in project

Malik_BasitMalik_Basit USMember
edited June 2013 in Prerelease & Betas

I want to use System.Net.Http assembly but i am not able to use it. So i downloaded it from internet, downloaded file version is 4.0.0, but other assemblies version is, that is why i am not able to compile the code.

<br /> var client = new HttpClient<br /> {<br /> BaseAddress = new Uri(server)<br /> };<br />

Error is: Error CS0029: Cannot implicitly convert type <code>System.Uri [System, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]' to System.Uri [System, Version=, Culture=neutral,

This post here says that xamarin now supports .Net 4.5 API.

Xamarin update channel is Alpha, and Xamarin(4.1.4) is Up to date. Xamarin.Android(4.7.8 Indie Edition)


  • nodoidnodoid GBMember, Beta ✭✭✭

    HttpClient is in System.Net.HttpClient - I know it's there, I've used it for some async work. When you say you downloaded the assembly from the internet, was it just the System.Net.HttpClient dll and if it was, how did you get it into the GAC?

    My advice would be to remove that dll completely and ensure that you have the latest alpha version installed and that you are targeting that rather than the older version (if the older version still exists on your machine that is!) and then try and rebuild.

    You will probably find this clears many issues.

  • Malik_BasitMalik_Basit USMember

    How can i check that older version still exists? and how can i remove them ?

  • RickyKaareRickyKaare DKUniversity ✭✭
    edited July 2013

    You might want to check out the NuGet package Microsoft.Net.Http.

    You can add it to your project using the NuGet Package Manger that exists as an add-in for both VisualStudio and Xamarin Studio.

  • StephaneCordonnierStephaneCordonnier FRMember ✭✭

    System.Net.Http.HttpClient is available directly from the latest version of Xamarin.

    Simply check for updates from Xamarin Studio ;-)

  • Malik_BasitMalik_Basit USMember

    I am still not able to include it, may be my project using old libraries, how can i delete them ? I am using Xamarin studio on Mac.

  • Ross_BRoss_B USMember ✭✭

    Thank you Pierce! I couldn't figure out why my class library project wasn't able to find System.Net.Http even though I'd upgraded my Xamarin Studio.


  • pierce.boggan

    Could you update whats wrong, when i am using System.Net.Http, there are many problems with Xamarin Studio on Mac

    Xamarin Studio
    Version 5.10.1 (build 6)
    Installation UUID:
    Mono 4.2.1 (explicit/6dd2d0d)
    GTK+ 2.24.23 (Raleigh theme)

    Package version: 402010102

    Not Installed

    Apple Developer Tools
    Xcode 6.4 (7720)
    Build 6E35b

  • DaveHuntDaveHunt USMember ✭✭✭✭✭

    @Gopinath.1872 said:
    when i am using System.Net.Http, there are many problems with Xamarin Studio on Mac

    You'll have to provide more information than that. What are the "many problems" you are having?

  • Me too i got this problem when i tried to add Microsoft.Net.Http in IOS project it refused am using xamarin.forms

  • MH79MH79 GBMember ✭✭

    Try to edit the profile of the visual studio .proj file to Profile111


  • Naveen9453Naveen9453 USMember ✭✭
    edited March 26

    Hi I am new to Xamarin ,
    In my project when i am adding System.Net.Http nuget package i am getting bellow error :

    Could not install package 'Microsoft.Bcl.Build 1.0.14'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v8.0', 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.

    Should I need to change 'MonoAndroid,Version=v8.0' to lower version or any nuget package dependeny is there.
    I am not able to resolve this error Please help.
    Thanks in Advance :)

  • XamarinRobertXamarinRobert USMember ✭✭

    For me, it was getting the nuget package Microsoft.Net.Http .(https://blogs.msdn.microsoft.com/bclteam/p/httpclient/)

  • Ashish_sharmaAshish_sharma INMember ✭✭

    _MT3001: Could not AOT the assembly '/Users/vikaspamnani/Desktop/Desktop/Ashish/CRM Project /CRM New 2/CRM/CRM.iOS/obj/iPhone/Debug/device-builds/iphone8.4-11.3/mtouch-cache/Build/System.Net.Http.dll .

    i face above error when build my xamarin.ios project, i'm using vs 2017 on mac , i has done this thing
    1.) Try to install Systm.Net.Http in ios package file but it not get install .
    2.) update xamarin.Forms package but it also not work for ios project . and do other more thing which i assume that will help to resolve this issue ,i get failure every time.

    output log is below : _
    there is lot of line then i show u only bug report

    Leads/Lead.xaml.cs(24,15,24,21): warning CS0169: The field 'Lead.campid' is never used
    /Users/vikaspamnani/Desktop/Desktop/Ashish/CRM Project /CRM New 2/packages/Microsoft.Bcl.Build.1.0.21/build/Microsoft.Bcl.Build.targets(243,5): warning : All projects referencing CRM.csproj must install nuget package Microsoft.Bcl.Build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317569.
    MTOUCH : warning MT0109: The assembly 'System.Net.Primitives.dll' was loaded from a different path than the provided path (provided path: /Users/vikaspamnani/Desktop/Desktop/Ashish/CRM Project /CRM New 2/CRM/CRM/bin/Debug/System.Net.Primitives.dll, actual path: /Library/Frameworks/Xamarin.iOS.framework/Versions/
    MTOUCH : error MT3001: Could not AOT the assembly '/Users/vikaspamnani/Desktop/Desktop/Ashish/CRM Project /CRM New 2/CRM/CRM.iOS/obj/iPhone/Debug/device-builds/iphone8.4-11.3/mtouch-cache/Build/System.Net.Http.dll'
    66 Warning(s)
    1 Error(s)

    Time Elapsed 00:01:45.26

    ---------------------- Done ----------------------

    Build: 1 error, 66 warnings

Sign In or Register to comment.