-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The dependency microsoft.AspNet.WebApi.Client does not support framework .NETCoreApp, Version=v1.0 #1558
Comments
Did you create a new RC2 .NET Core project? I just tried, File -> New Project -> ASP.NET Core Web Application (.NET Core) -> Empty project. Added Did you perhaps covert an RC1 application? |
@davidfowl That package supports
|
You need to add an import in order to restore, there is a tracking bug for it http://aspnetwebstack.codeplex.com/workitem/2304 |
@svick I know, but the new project template has imports in them. I'm guessing you didn't make a new project. |
Even with
|
imports dnxcore50 won't help with {
"frameworks": {
"imports" : ["dnxcore50", "portable-net45+netcore45+wp8+wp81+wpa81"]
}
} |
Well, it allows me to restore now, but it still doesn't build.
It looks like Microsoft.AspNet.WebApi.Client references Microsoft.Net.Http which is an older (deprecated?) version of System.Net.Http. Am I just SOL if I want to reference these in a net core project? |
cc @dougbu |
@chadly could you please try Microsoft.AspNet.WebApi.Client v5.2.2? That's what we use in MVC's WebApiCompatShim. See https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/project.json#L26 Please let us know how this goes. If it works, would be good to know why; if it doesn't, we have the mystery of the |
Actually, ignore everything about package versions. I didn't read far enough in the Instead add "imports": [
"portable-net451+win8"
] to the |
Thanks @dougbu! That did it. For future reference, here is what worked for me: "frameworks": {
"netcoreapp1.0": {
"imports": [
"dnxcore50",
"portable-net451+win8"
]
}
},
"dependencies": {
"System.Net.Http": "4.1.0",
"Microsoft.AspNet.WebApi.Client": "5.2.3"
} |
@chadly Are you perhaps building on a Windows machine? What worked for you isn't working for me, at least not when I'm trying to build a console application on a mac. |
@danielbsig no, I was on compiling on Ubuntu |
I have just got this working a Mac using the following project.json
As a side note, i needed to add System.Runtime.Serialization.Xml when i added Newtonsoft.Json due to an issue with dependencies. |
I had exactly the same problem with an asp.net console app. The solution mentioned above by dougbu and chadly worked perfectly. The only difference in my environment is that my framework was netstandard1.6 not netcoreapp1.0, but it worked also "frameworks": { |
Hello Everyone, I'm also working on the same thing. I want to make some httpclient calls to the server. using .net framework its easy to do. But using .net core I'm unable to do it. I would really appreciate if anyone can provide me any reference or an idea how to do it it will be really helpful. To be more specific about my question, I would generalize it: That is, I want to make HttpClient calls to the server, to request for the api to the server and get the response back from the server in the form of http requests and response. Thank You! I look forward for your response. Best regards, Sandeep |
@SandeepApsingekar you don't need Microsoft.AspNet.WebApi.Client for that, it just has fancy body serialization methods. System.Net.Http should be adequate for most needs. |
@Tratcher Hey Chris, Thank you for following up with me. In .NET framework I used to do that using Microsoft.AspNet.WebApi.Client. I would really appreciate your help if you can provide me with any online reference or a sample code which uses HttpClient class using .NET Core. Thank You! I look forward for your response. |
What are you trying to do that doesn't work? |
Hi Then I wrote a async get method for the response. So, I wanted to know whether I'm going in right direction? I'm new to .net core. Thank you! Best Regards, |
That's a good start. next call |
Awesome! This link is really helpful has saved a lot of time. I really appreciate your help. Thank You! Best Regards, Sandeep |
Whats the fix for this on a project thats on vs2017 csproj format targeting netcoreapp1.1? |
Hi all, I've got the same error when I tried to add Microsoft.AspNet.WebApi.Client 5.2.3 from NuGet into a netStandard1.6 class library(in VS 2017). I guess i have to modify the project.assets.json file but i don't really know where should I modify it. Thank you in advance! Kind regards, |
If you can target .NETStandard 1.6, you might as well reference Microsoft.AspNetCore.Mvc.WebApiCompatShim directly (search nuget.org). For those of us needing to target .NETStandard 1.4, this appears to work (assumes VS 2017): you need to have the PCL target fall back in the app csproj as well as all the csproj in between. I created my own Acme.WebApiCompatShim csproj, that looks like this (it has no code, just a shim):
So if you have console app (netcoreapp1.1) => client library (netstandard 1.4) => Acme.WebCompatShim, you need
in both the console app .csproj and the client library .csproj. And then in the client library you can do stuff like this again:
|
Hi Kimberly, Thank you for the information. I'll try your solution. In the meantime i found some alternative solution here. and it worked for me. Many thanks, |
It is being tracked here: It has been committed to Microsoft.AspNet.WebApi.Client 5.2.4 but not yet released. |
Due to issues currently with Net Core we have to use a framework fallback hack in the csproj to be able to add the nuget AspWebApiShim project. To track this fault go to this issue: dotnet/aspnetcore#1558
@vanillajonathan I'm having the same issue in a project I'm working on. Nuget is still 5.2.3. Any date for 5.2.4? thanks! |
@darkguy2008 It will be out sometime during 2007 according to @Eilon. I currently use the 5.2.4-alpha version hosted on MyGet. |
I received similar error in a Console App (Net Core) built on TargetFramework 2.0. The issue was resolved immediately after installing the Microsoft.AspNetCore.Mvc.WebApiCompatShim -Version 2.0.0 ` |
This issue is being closed because it has not been updated in 3 months. We apologize if this causes any inconvenience. We ask that if you are still encountering this issue, please log a new issue with updated information and we will investigate. |
As of Feb 2018, |
I install the preview... (nuget) then on compile...Error: Detected package downgrade: Microsoft.AspNet.WebApi.Client from 5.2.4-preview1 to 5.2.3. Reference the package directly from the project to select a different version...... What does it mean reference the package directly from the project? |
@sbrian26 - you probably have another package in your app that is requesting a lower version of that package. You can add an explicit reference to that package version to force NuGet to pick the one you want. |
I created a .NETCore console application and using System.Net.Http.Since i need http.content to be included in my code, i installed Microsft.AspNet.WebApi.Client dependency using Package Manager Console.It installed successfully but i encountered an error as mentioned in the title. We know we need this dependency to add support for formatting and content negotiation for system.Net.Http . Can anyone help me in this issue ?
P.S I wanted to add this dependency because in my code i found this error : HttpContent doesnot contain a definition for 'ReadAsAsync' and no extension method 'ReadAsAsync' accepting a first argument of type HttpContent could be found when i am using response.Content.ReadAsAsync in my program.cs
The text was updated successfully, but these errors were encountered: