首页 > 解决方案 > Azure function wants two versions of the same DLL

问题描述

I have an azure function that calls a static method from a DLL I created separately and uploaded to the function folder, along with all of its dependencies (all dll's from the release folder were uploaded to the azure function).

When i try to call the function i receive an error Could not load file or assembly 'Microsoft.SharePoint.Client.Runtime, Version=16.1.3912.1204

If i upload this version of Microsoft.SharePoint.Client.Runtime, i receive an error that it wants the other version again: Could not load file or assembly 'Microsoft.SharePoint.Client.Runtime, Version=16.0.0.0

How can this be? It runs successfully outside Azure. Why does it want two versions of the same DLL? The project references 16.1.3912.1204, and this is the version of the dll in the \bin\release folder.

Side note: my .NET GAC folder contains version 16.0.0.0. If it is the case that for some reason inside the Microsoft.SharePoint.Client dll's it needs to reference both versions, how can i include two versions of the same file in an azure function?

标签: functionazurereference.net-assembly

解决方案


确保所有项目引用都指向包文件夹 (nuget) dll 以消除版本冲突,然后从 bin 文件夹上传所有 DLL 解决了这种情况下的问题。


推荐阅读