Azure Functions 依赖项与 AzureFunctionsTools 依赖项发生冲突

Azure Functions dependency collisions with AzureFunctionsTools dependencies

我有一个 Azure 函数,它有许多依赖项,包括 Nuget.VersioningMicrosoft.Extensions.Logging.Abstractions

当我尝试启动我的函数(本地或已部署)时,导致这些文件出错:

System.Private.CoreLib: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

正确的版本在 bin 目录中,所以当我查看加载的模块时,我可以看到这些依赖项的旧版本,它们已经被加载,位于: C:\Users\<user>\AppData\Local\AzureFunctionsTools\Releases.23.5\cli_x64

有没有比让我的 nuget 依赖项以任何 AzureFunctionsTools 依赖项的相同版本为目标更好的解决方法?

随机查看一长串 AzureFunctionsTools 依赖项,其中有一些已经过时了。我的功能是使用.net core 3.1.

您可以尝试将所有 5.0.0 库(例如 Microsoft.EntityFrameworkCore.SqlServerMicrosoft.EntityFrameworkCoreMicrosoft.EntityFrameworkCore.SqlServer.NetTopologySuitefrom 5.0 降级为 3.1.x.

或者,升级到 .Net 5

请参阅 GitHub issue and 以获取有关类似问题的进一步参考。