Azure函数不会自动加载nuget程序集

标签 azure azure-functions

我已经使用自定义程序集创建了 nuget 包。它安装得很好,但是函数运行时没有加载程序集,因为它应该根据文档加载

When you upload a project.json file, the runtime gets the packages and automatically adds references to the package assemblies. You don't need to add #r "AssemblyName" directives. Just add the required using statements to your run.csx file to use the types defined in the NuGet packages.

因此,任何包含我的包中的命名空间的 using 语句都会使该函数无法编译。

该程序集的目标是 .net 4.6.1,我可以读到的一个问题是,函数仅支持项目 json 中的 4.6。

如果我使用 #r "......\data\Functions\packages\nuget\letsencrypt.azure.core\0.6.16-prerelease\lib\net461\LetsEncrypt 引用它,我可以加载程序集.SiteExtension.Core.dll”

然而,这只会导致来自 nuget 的所有其他依赖项也丢失。我真的必须手动引用每个 nuget 才能使其工作吗?

最佳答案

事实证明,如果您以 4.6.1 为目标,则会出现问题。当我将其更改为 4.6 时,它现在似乎可以工作。

关于Azure函数不会自动加载nuget程序集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43621228/

相关文章:

azure - response.Content.ReadAsStringAsync 不读取所有数据

azure - CosmosDB模拟器: The value for one of the HTTP headers is not in the correct format

c# - 如何以编程方式触发 azure 函数在 C# 代码中运行?

azure - 如何从azure功能将消息添加到azure服务总线?

azure - 需要在azure服务中使用appsettings

azure - 如何在 Azure 云中禁用虚拟机的 Azure Bastion?

node.js - Node JS Sequelize 无法连接到 Azure SQL 数据库

python-3.x - 在 Visual Studio Code 上使用 Python 创建 Azure 函数以触发队列

json - 如何合并两个 ARM 模板 JSON 参数文件并覆盖重复参数?

azure - 在 Azure DevOps Pipeline 模板中使用变量