Error: Could not load file or assembly "System.Net.Http.Primitives, Version = 1.5.0.0 ..."

I am using Windows Azure Web Jobs to execute my method for getting tweets using LinqToTwitter. My web.config file has

<dependentAssembly>
    <assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.2.22.0" newVersion="4.2.22.0" />
</dependentAssembly>

      

When I debug my test project, I don't get any errors. But after posting my web api to Azure, I am getting below error when starting the web job:

System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Http.Primitives, Version = 1.5.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a' or one of its dependencies. the system cannot find the file specified.

More details register information here .

+3


source to share


1 answer


I solved my similar problem by installing Microsoft HTTP Client Libraries 4.2.29.0 in my main WPF application, although I cannot use them there. The TESTER application against my assembly YouTubeDataV3.DLL works, but not when I try to use it from a WPF application (all projects were installed in NET 4.5).

I first tried to manually change app.config and C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ config \ machine.config, but I always saw the same exceptions



System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Http.Primitives, Version = 4.2.29.0 ...

System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Http.Primitives, Version = 1.5.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a' or one of its dependencies.

I think something is wrong with NuGet in that it stores a peer package folder for a solution, not a peer reference to a NuGet managed project. IOW. If you have x number of client project projects consuming assembly "A" that is referenced by NuGet, then you get x number of package folders scattered all over the place where solution (.SLN) files reside. This is a really ugly plus, keep in mind all this stuff :) will be copied into bin / debug and bin / release :( again. What a wasteful approach.

+1


source