我正在将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)
NuGet确实安装了所有依赖项,包括Google.Apis.Auth.dll,但它是1.27.1。我尝试了所有我能想到的一切,包括获取1.21.0的dll并使用它,但没有成功。我已经能够正常运行.net示例,没有错误。
有什么想法吗?让我知道您是否需要更多信息
好的,我已经找到了对Google.Apis.Auth 1.21.0的引用-它位于Grpc.Auth
NuGet包中。
如果仅添加对Grpc.Auth
DLL的引用,则会遇到这种故障-但是如果您通过NuGet管理所有依赖项,我希望它可以-它将为您添加程序集绑定重定向。
在不知道您确切的设置的情况下,要讲的更多技巧是非常棘手的-可能是您的库需要程序集绑定重定向,但是应用程序可以控制它们……尤其是如果您的应用程序仅引用了库DLL,这将导致问题。
解决方法是,您可以手动添加程序集绑定重定向(确切的操作方式取决于应用程序类型),也可以Google.Cloud.PubSub.V1
在应用程序和库中添加对它的引用,此时NuGet将完成所有为您处理依赖项。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句