我已经使用自定义程序集创建了 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/