具有相同依赖项的不同版本的 nuget 包的 azure 函数 [英] azure functions with nuget packages that have different versions of the same dependency

查看:32
本文介绍了具有相同依赖项的不同版本的 nuget 包的 azure 函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个 Azure 函数,该函数使用来自我的私人订阅源的 2 个 nuget 包(A 和 B).包 A 直接使用 Dapper 版本 1.50.2,包 B 使用 Dapper.SimpleCrud 1.13.0,它依赖于 Dapper 版本 [1.42.0, 2.0.0).

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 函数中,我添加了 project.json,我在其中指定了包 A 和 B 及其版本.

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

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

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)

我创建了 Dapper.SimpleCRUD 包的测试版本,其中对 dapper 的依赖来自 [1.50.2, 2.0.0) 并且一切正常.

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 1.50.2 添加到 project.json 中,希望 Dapper.SimpleCRUD 可以使用它,但它似乎仍然会引入 Dapper 1.42.

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.

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

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 ?.

感谢您提供的任何帮助.

Thanks for any help you can provide.

推荐答案

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

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.

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

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

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

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

我最终保留了尽可能少的 nugets 以避免绑定重定向.如果您的项目无法做到这一点,请尝试使用网络作业(至少作为短期解决方案),直到 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.

这篇关于具有相同依赖项的不同版本的 nuget 包的 azure 函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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