I am trying to create a library to call web services, its pretty simple, I have: 1.library of class proyect framework 4.6.1 2.From nugget I add the Newtonsoft.Json v10.0.2 3.FRom nugget I add the System.Net.Http v4.3.1 4. FRom nugget I add System.Net.Http.Formating.Extention v5.2.3
I got this function:
static async public Task<ObservableCollection<CProyecto>> GetProyectos()
{
try
{
using (System.Net.Http.HttpClient client = new System.Net.Http.HttpClient())
{
...........
}
}
catch (Exception e)
{
Error = e.Message;
}
return something;
}
When I run I got a runtime error:
"Could not load file or assembly 'System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified..":"System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
I really dont know what to do,... I've try using older versions bu I got the same error
Any Idea ? thanks in advance
After a day I've found the problem,... maybe will be useful to someone: I have a ViewModel Project referencing to my "problematic" project (ServiceCaller Project) The error was located on the ViewModel project. It has a reference to the System.Net.Http 4.0.0. I just delete the reference to that assembly and all is working now.