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 2.0.5.0, 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=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]' to System.Uri [System, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]'(CS0029)

This post here says that xamarin now supports .Net 4.5 API.
http://blog.xamarin.com/brave-new-async-mobile-world/

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

Posts

  • 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.

  • RossBenderRossBender 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.

    Cheers!

  • 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:
    Runtime:
    Mono 4.2.1 (explicit/6dd2d0d)
    GTK+ 2.24.23 (Raleigh theme)

    Package version: 402010102
    

    Xamarin.Profiler
    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

    Profile111

Sign In or Register to comment.