vb.net
vb.net

Reputation: 31

error showing in the downloaded dll

Am on integrating google calander using google api version 3, using NuGet package Install-Package Google.Apis.Calendar.v3 and also referring this link. while running the web application am getting the error as :

System.IO.FileLoadException**: Could not load file or assembly 'System.Net.Http.Primitives, Version=2.2.22.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) ---> System.IO.FileLoadException: 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 located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

the web config file am using for this is:

<configuration>
  <system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
  </system.web>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.2.22.0" newVersion="2.2.22.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.5.0.0" newVersion="2.2.22.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

the package config is like :

<?xml version="1.0" encoding="utf-8"?>
<packages xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
  <package id="Google.Apis" version="1.9.0" targetFramework="net40" />
  <package id="Google.Apis.Auth" version="1.9.0" targetFramework="net40" />
  <package id="Google.Apis.Calendar.v3" version="1.9.0.1110" targetFramework="net40" />
  <package id="Google.Apis.Core" version="1.9.0" targetFramework="net40" />
  <package id="log4net" version="2.0.3" targetFramework="net40" />
  <package id="Microsoft.Bcl" version="1.1.9" targetFramework="net40" />
  <package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net40" />
  <package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net40" />
  <package id="Microsoft.Net.Http" version="2.2.22" targetFramework="net40" />
  <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net40" />
  <package id="Zlib.Portable" version="1.10.0" targetFramework="net40" />
</packages>

bith are similar to what in the reference link

Updates:

--- End of inner exception stack trace --- at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task) at Microsoft.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker.<AuthorizeAsync>d__1.MoveNext() in c:\code\google.com\google-api-dotnet-client\default\Tools\Google.Apis.Release\bin\Debug\test\default\Src\GoogleApis.Auth.DotNet4\OAuth2\GoogleWebAuthorizationBroker.cs:line 59 --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.get_Result() at testVB.home.Page_Load(Object sender, EventArgs e) in D:\GoogleCalandarDemo\testApp\testVB\home.aspx.vb:line 26

does it means the error is in the dll i was referring?

Upvotes: 2

Views: 1727

Answers (2)

John
John

Reputation: 3702

Have you installed the "Microsoft Http Client Libraries" from Nuget? This might be the issue.

PM> Install-Package Microsoft.Net.Http

Upvotes: 1

dotnetstep
dotnetstep

Reputation: 17485

Make sure you have 2.2.22.0 version assembly in your reference. Try to clean and build your project again. (In this case check your bin as well that it has 2.2.22.0 version)

And replace

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

with

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

Upvotes: 0

Related Questions