Azure Functions dll版本不匹配 [英] Azure Functions dll version mismatch

查看:95
本文介绍了Azure Functions dll版本不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个Azure函数,该函数通过私有Nuget提要引用外部程序集.

We have an Azure function which references an external assembly via a private Nuget feed.

我们遇到的问题是,我们有两个不同版本的Microsoft.Azure.WebJobs.dll-一个是nuget包的依赖项,另一个是我想由运行时提供的版本.

The problem we're having is that we have two different versions of Microsoft.Azure.WebJobs.dll - one which is a dependency of our nuget package and another which I'm assuming is being provided by the runtime.

 error CS1503: Argument 2: cannot convert from 'Microsoft.Azure.WebJobs.ICollector<Microsoft.WindowsAzure.Storage.Table.ITableEntity> [D:\Program Files (x86)\SiteExtensions\Functions\1.0.10635\bin\Microsoft.Azure.WebJobs.dll]' to 'Microsoft.Azure.WebJobs.ICollector<Microsoft.WindowsAzure.Storage.Table.ITableEntity> 

我发现了这个问题,它说不支持绑定重定向:

I found this question which says that binding redirects are not supported:

Azure Functions绑定重定向

我们可以尝试删除对该库的依赖,也可以匹配Azure Functions使用的版本,但是我认为无论如何使用Microsoft.WindowsAzure.Storage都会遇到相同的问题.

We could try to remove our dependency on that library, or we could match the version used by Azure Functions, but I think we're going to have the same problem with using Microsoft.WindowsAzure.Storage anyway.

请告知!

推荐答案

您正确的是不支持绑定重定向.运行时对WebJobs SDK和存储库有自己的依赖性,因此传递到函数中的对象将来自这些版本.我建议删除您对其他版本的依赖关系并加入我们的版本.请注意,对于这些库,您不必添加自己的程序包引用,您可以通过以下方式在函数代码中引用我们的程序包引用:

You are correct that binding redirects are not supported. The runtime has its own dependencies on the WebJobs SDK and Storage libraries so objects passed into your functions will be from those versions. I recommend removing your dependencies on other versions and snapping to ours. Note that for these libraries, you don't have to add your own package reference, you can reference ours in your function code via:

#r "WindowsAzure.Storage"

您不需要为WebJobs SDK类型(例如ICollector<T>)添加显式的#r引用-运行时会隐式添加该程序集.当然,这仅适用于我们为您编译的功能代码,而不适用于来自外部软件包的代码.

You don't need to add explicit #r references for WebJobs SDK types (e.g. ICollector<T>) - the runtime adds that assembly implicitly. Of course this only applies for function code we're compiling for you, not code coming from your external packages.

将来,我们可能会在这方面进行改进,但现在,如果您尝试使用有冲突的版本,您将一头雾水.

In the future we might improve things in this area, but for now you'll be swimming up stream if you try to use conflicting versions.

这篇关于Azure Functions dll版本不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆