Pergunta

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?

Foi útil?

Solução 2

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)

Outras dicas

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.

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.

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>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top