3

Just downloaded a fresh copy of google-drive-v2-rev82-csharp-1.4.0-beta.zip and added a reference to Google.Apis.Drive.v2.dll in my VS 2012 C# project. I also added references to all the dll's in the Lib folder of the zip file. When I run the project it complains that version 2.1.10.0 of System.Net.Http.Primitives was found when it expected version 1.5.0.0. I tried adding the following to App.config but it still crashes when ran:

<runtime>
<assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentassembly>
    <assemblyidentity name="System.Net.Http.Primitives" 
                        culture="neutral" 
                        publickeytoken="b03f5f7f11d50a3a"/>
    <bindingredirect newVersion="2.1.10.0" oldVersion="1.5.0.0"/>
  </dependentassembly>
</assemblybinding>
</runtime>

Am I just missing some concept or is there a different file I need to be downloading or what?

GeneBean
  • 361
  • 4
  • 17
  • I had this same issue. This worked for me: http://stackoverflow.com/questions/18370360/could-not-load-file-or-assembly-system-net-http-primitives-located-assemblys-m – dlm Jul 01 '15 at 03:02

4 Answers4

4

I am using an upgraded version of the Nuget packages and was getting the same error. I copied the following line to the application host configuration and that worked for me :-).

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

Located under assemblyBinding tag within runtime tag.

DatRid
  • 1,169
  • 2
  • 21
  • 46
Kishor Jha
  • 41
  • 3
  • Code Snippets only work for JavaScript, CSS and HTML. Please have a look at http://blog.stackoverflow.com/2014/09/introducing-runnable-javascript-css-and-html-code-snippets/?cb=1 Thats also the reason I edited your post :) – DatRid Nov 05 '14 at 16:29
  • I appreciate your help in editing my post. I am still getting used to stackoverflow. – Kishor Jha Nov 07 '14 at 21:20
1

Please follow our instructions in the Build wiki page. I recommend you to use NuGet to get the 3rd party packages (including Microsoft.Net.Http package)

peleyal
  • 3,472
  • 1
  • 14
  • 25
  • 1
    I'm using NuGet and still receive the error stating that System.Net.Http.Primitives v1.5 is required. – mcohen75 Sep 11 '13 at 14:36
  • @peleyal - like mcohen75 I am using exclusively NuGet, but am still seeing the error asking for version 1.5.0.0; I have added the configurations to app.config just in case and that didn't help any. I've added and removed multiple times via NuGet but still get the error when trying to create a Directory Service or Drive Service. NuGet is up to date... ideas? – squid808 Oct 05 '13 at 04:17
  • Try to install the following update for .NET 4.0 http://support.microsoft.com/kb/2468871 and let me know – peleyal Oct 08 '13 at 13:04
  • Unfortunately the update 'does not apply, or is blocked by another condition on your computer.' Fwiw, I'm also having a ball with [this issue](http://goo.gl/YlD60U). I recognize they seem to be unrelated, but both new issues since moving off the old gData APIs. – squid808 Oct 10 '13 at 19:57
1

This did not work for me. What I did to fix this was to go to Visual Studio menu option Tools > Library Package Manager > Manage NuGet Packages For Solution. From there find the package "Microsoft HTTP Client Libraries" and click on it. The "Manage" button will appear; click on it. Find your package that is having the error and select it and then press ok. It should work.

A little history ... Now, this is a strange error. I built a Google API extract and tested it using a web page and everything worked. I then built a Console App project. All this console app project had in it was a call to the same static method of the same class in a class library that my web page called but I had the error described above. I added the references in my app.config with no luck in the same way the GeneBene did. After I added the package manually to the console app it worked but I never had to do this with my web application. I must say, I am not really liking this NuGet. I have had all kinds of strange problems with it.

Mark Dornian
  • 318
  • 4
  • 9
1

If you are doing an worker role for azure, just include an app.config and the following code:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-2.2.18.0" newVersion="2.2.18.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>
Abel Rojas
  • 29
  • 4