Ham*_*mmy 5 c# nuget google-cloud-pubsub
我正在努力将 Google Cloud PubSub 集成到我的 c# 项目中,我使用 NuGet 安装1.0.0-beta11,没有任何错误。当我运行我的项目并到达使用 pubsub 的代码时,出现以下错误:
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's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Run Code Online (Sandbox Code Playgroud)
NuGet确实安装了包括Google.Apis.Auth.dll在内的所有依赖项,但它是1.27.1。我已经尝试了我能想到的一切,包括获取该 dll 的 1.21.0 并使用它,但没有成功。我已经能够很好地运行.net 示例,没有错误。
有什么想法吗?如果您需要更多信息,请告诉我
好的,我找到了对 Google.Apis.Auth 1.21.0 的引用 - 它位于Grpc.Auth
NuGet 包中。
如果您只是添加对 DLL 的引用Grpc.Auth
,您将遇到这种失败 - 但如果您通过 NuGet 管理所有依赖项,我希望它没问题 - 它应该为您添加程序集绑定重定向。
在不知道您的确切设置的情况下,很难说更多 - 可能您的库需要程序集绑定重定向,但应用程序可以控制它们......特别是,如果您的应用程序仅引用库 DLL,这会导致问题。
作为解决方法,您可以手动添加程序集绑定重定向(具体执行方式取决于应用程序类型),或者仅添加对应用Google.Cloud.PubSub.V1
程序和库的引用,此时 NuGet 将执行所有操作为您处理依赖关系。
归档时间: |
|
查看次数: |
2035 次 |
最近记录: |