具有相同依赖关系的不同版本的nuget包的azure函数

时间:2022-09-08 16:54:34

I am writing an Azure Function that is using 2 nuget packages (A and B) from my private feed. Package A uses Dapper version 1.50.2 directly and package B uses Dapper.SimpleCrud 1.13.0 which has a dependency on Dapper version [1.42.0, 2.0.0).

我正在编写一个Azure函数,它使用我的私有Feed中的2个nuget包(A和B)。包A直接使用Dapper版本1.50.2,包B使用Dapper.SimpleCrud 1.13.0,它依赖于Dapper版本[1.42.0,2.0.0]。

Within the Azure Function I have added project.json where I specify package A and B and their versions.

在Azure函数中,我添加了project.json,其中指定了包A和B及其版本。

When I look at the installed packages within the azure function I see Dapper 1.42.0 and 1.50.2 are both installed. when I attempt to call methods in package A and B I get an error on the azure function logs saying that it could not find Dapper version 1.40. (depending on how I set my project.json it would be either Dapper 1.40 or 1.50 that is not found by Azure Function)

当我查看azure函数中安装的软件包时,我看到Dapper 1.42.0和1.50.2都已安装。当我尝试调用包A和B中的方法时,我在azure函数日志中收到错误,说它无法找到Dapper版本1.40。 (取决于我如何设置我的project.json,它将是Azure功能找不到的Dapper 1.40或1.50)

I have created a test version of the Dapper.SimpleCRUD package where the dependency on dapper is from [1.50.2, 2.0.0) and every thing works.

我已经创建了Dapper.SimpleCRUD包的测试版本,其中对dapper的依赖性来自[1.50.2,2.0.0]并且每件事都有效。

I have also tried to add Dapper 1.50.2 to project.json in the hopes that it will be used by Dapper.SimpleCRUD, but it still seems to pull in Dapper 1.42.

我也尝试将Dapper 1.50.2添加到project.json中,希望它能被Dapper.SimpleCRUD使用,但它似乎仍然可以吸引Dapper 1.42。

Is there some setting that I missing on Azure Functions to allow this setup to work or is this a limitation on Azure Function package management ?.

我是否在Azure功能上缺少某些设置以允许此设置工作,或者这是Azure功能包管理的限制?

Thanks for any help you can provide.

感谢您的任何帮助,您可以提供。

1 个解决方案

#1


4  

I seems like an issue (AFAIK even as late as Oct 2016) that they still haven't figured out a good way of doing binding redirects in azure function.

我似乎是一个问题(AFAIK甚至直到2016年10月),他们仍然没有想出一个在azure函数中进行绑定重定向的好方法。

I ran into a similar issue with my azure function using two different nuget packages with same dependency (but different versions).

我使用两个具有相同依赖性(但不同版本)的不同nuget包遇到了与我的azure函数类似的问题。

There was a similar question asked here : Azure Functions binding redirect

这里有一个类似的问题:Azure功能绑定重定向

I ended up keeping the least possible number of nugets to avoid binding redirects. If this is not possible with your project try using for webjobs (atleast as a short term solution) till azure functions supports this.

我最终保留了尽可能少的数量以避免绑定重定向。如果您的项目无法做到这一点,请尝试使用webjobs(至少作为短期解决方案),直到azure功能支持此功能。

#1


4  

I seems like an issue (AFAIK even as late as Oct 2016) that they still haven't figured out a good way of doing binding redirects in azure function.

我似乎是一个问题(AFAIK甚至直到2016年10月),他们仍然没有想出一个在azure函数中进行绑定重定向的好方法。

I ran into a similar issue with my azure function using two different nuget packages with same dependency (but different versions).

我使用两个具有相同依赖性(但不同版本)的不同nuget包遇到了与我的azure函数类似的问题。

There was a similar question asked here : Azure Functions binding redirect

这里有一个类似的问题:Azure功能绑定重定向

I ended up keeping the least possible number of nugets to avoid binding redirects. If this is not possible with your project try using for webjobs (atleast as a short term solution) till azure functions supports this.

我最终保留了尽可能少的数量以避免绑定重定向。如果您的项目无法做到这一点,请尝试使用webjobs(至少作为短期解决方案),直到azure功能支持此功能。