Could not start Google Cloud PubSub in C #, problems with DLL

I am working on integrating Google Cloud PubSub into my C # project, I used NuGet to install 1.0.0-beta11 , no errors at all. When I run the project and when it reaches the code that pubsub uses, I get the following error:

An unhandled exception of type 'System.IO.FileLoadException' occurred in Google.Api.Gax.dll Additional information: Could not load file or assembly 'Google.Apis.Auth, Version=1.21.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab' or one of its dependencies. The located assembly manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 

NuGet installed all the dependencies, including Google.Apis.Auth.dll, but it is 1.27.1. I tried everything I could think of, including grabbing 1.21.0 of this DLL and using this, but not success. I was able to run the .NET sample just fine, with no errors.

Any thoughts? Let me know if you need more information.

+2
source share
1 answer

Ok, I found a link to Google.Apis.Auth 1.21.0 - this is the Grpc.Auth package in Grpc.Auth .

If you just add a reference to the Grpc.Auth DLL, you will get such a failure, but if you manage all the dependencies through NuGet, I would expect that everything will be alright - it should add assembly binding redirects for you.

Without knowing the exact settings, it’s quite difficult to say more - it’s possible that your library needs to redirect assembly bindings, but the application controls them ... and, in particular, if your application has only a link to the library DLL, which will cause a problem.

As a workaround, you can manually add assembly binding redirects (the exact way to do this will depend on the type of application) or just add a link to Google.Cloud.PubSub.V1 in the application, as well as to the library where the NuGet point will perform all the processing dependencies for you.

+2
source

Source: https://habr.com/ru/post/1271602/


All Articles