google-api-dotnet-client

Google API: Unable to find Grpc.Core types. Please ensure you have a suitable Grpc.Core dependency error


Using the Google API .NET client version 4.4.0 in an ASP.NET Framework (4.7.2) app.

Everything works great on my development PC, but after I transfer it to the server, I get the following error when it tries to create the client.

Unable to find Grpc.Core types. Please ensure you have a suitable Grpc.Core dependency at Google.Api.Gax.Grpc.GrpcCoreAdapter.CreateChannelFactory() in /_/Google.Api.Gax.Grpc/GrpcCoreAdapter.cs:line 64

var client = new FirestoreClientBuilder();

I've tried searching for the error with no success.

Things I've done:

  1. Checked that all Google and Grpc DLLS are in the bin folder
  2. Checked the assembly references in web.config
 <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
   <dependentAssembly>
     <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-2.0.15.0" newVersion="2.0.15.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="Google.Apis.Auth" publicKeyToken="4b01fa6e34db77ab" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-1.64.0.0" newVersion="1.64.0.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-3.25.1.0" newVersion="3.25.1.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="Google.Api.Gax.Grpc" publicKeyToken="3ec5ea7f18953e47" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="Google.Api.Gax" publicKeyToken="3ec5ea7f18953e47" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="Google.Api.CommonProtos" publicKeyToken="3ec5ea7f18953e47" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-2.13.0.0" newVersion="2.13.0.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
   </dependentAssembly>
   <dependentAssembly>
     <assemblyIdentity name="System.Net.Http.WinHttpHandler" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
   </dependentAssembly>
 </assemblyBinding>

I feel like it's either a missing file or web.config setting. Any help apprecicated.


Solution

  • I was able to locate the missing files needed for the app:

    Grpc.Core.dll
    
    located in packages\Grpc.Core.2.46.6\lib\net45
    

    The file was not included in the web app's published files probably because the Google API client is used in another project referenced by the web app.

    Hope this helps somebody in the future!