问题描述
我正在从Azure函数(服务总线队列触发器)中引用C#库项目.该库引用的是Newtonsoft nuget版本10.0.1.在我的Visual Studio上本地运行该功能时,会出现此错误.
I am refering a C# library project from my Azure Function (Service bus queue trigger). The library is referencing the Newtonsoft nuget version 10.0.1.While running the function locally on my visual studio, it gives this error .
{"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版,但问题出在这里.
I tried downgrading to version 10.0.0, but the issue is there.
我偶然发现了此问题链接: https://github.com/Azure/azure-functions-vs-build-sdk/issues/107 .并尝试降级到9.0.1.但是即使那样,错误仍然会发生.
I stumbled upon this issue link : https://github.com/Azure/azure-functions-vs-build-sdk/issues/107. And tried downgrading to 9.0.1. But even then the error still occurs.
注意:库项目引用了其他几个库项目,这些项目也都引用了Newtonsoft.我在所有子项目中都使用了相同版本的nuget.
Note: The library project reference several other library projects which are also referencing Newtonsoft. I am keeping the same version of the nuget all the sub projects.
如何解决此问题?
推荐答案
将所有子库中的所有Newtonsoft dll指向版本9.0.1解决了该问题.
Pointing all the Newtonsoft dlls in all the sub libraries to version to 9.0.1 solved the issue.
这篇关于无法在Azure函数中加载文件或程序集'Newtonsoft.Json,Version = 10.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!