我正在从我的 Azure Function(服务总线队列触发器)引用 C# 库项目。该库引用 Newtonsoft nuget 版本 10.0.1。 在我的 Visual Studio 上本地运行该函数时,出现此错误。
{"Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.":"Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed"}
我尝试降级到版本 10.0.0,但问题仍然存在。
我偶然发现了这个问题链接:https://github.com/Azure/azure-functions-vs-build-sdk/issues/107 。 并尝试降级到9.0.1。但即使如此,错误仍然发生。
注意:该库项目引用了其他几个库项目,这些项目也引用了 Newtonsoft。我在所有子项目中保留相同版本的 nuget。
如何解决这个问题?
最佳答案
将所有子库中的所有 Newtonsoft dll 指向版本 9.0.1 解决了该问题。
关于c# - 无法在 Azure Functions 中加载文件或程序集 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47351068/