简体   繁体   English

Azure功能不会自动加载nuget程序集

[英]Azure function doesn't automatically load nuget assemblies

I have created nuget package with my custom assembly. 我用自定义程序集创建了nuget包。 It install just fine, but the assemblies are not loaded by the function run time as it should according to the documentation 它安装得很好,但程序集不会被函数运行时加载,因为它应该根据文档

When you upload a project.json file, the runtime gets the packages and automatically adds references to the package assemblies. 上载project.json文件时,运行时获取包并自动添加对包程序集的引用。 You don't need to add #r "AssemblyName" directives. 您不需要添加#r“AssemblyName”指令。 Just add the required using statements to your run.csx file to use the types defined in the NuGet packages. 只需将所需的using语句添加到run.csx文件即可使用NuGet包中定义的类型。

Thus any using statement including namespaces from my package will just make the function unable to compile. 因此,任何包含我的包中的命名空间的using语句都只会使该函数无法编译。

The assembly is targeting .net 4.6.1 is that a problem I can read that functions only support 4.6 in for the project json. 该程序集的目标是.net 4.6.1是我能读到的一个问题,该函数只支持项目json的4.6 in。

I can get the assembly to load if I reference it using #r "......\\data\\Functions\\packages\\nuget\\letsencrypt.azure.core\\0.6.16-prerelease\\lib\\net461\\LetsEncrypt.SiteExtension.Core.dll" 如果我使用#r“...... \\ data \\ Functions \\ packages \\ nuget \\ letsencrypt.azure.core \\ 0.6.16-prerelease \\ lib \\ net461 \\ LetsEncrypt.SiteExtension引用它,我可以加载程序集。 Core.dll”

This however just leads to all the other dependencies coming from nuget to also be missing. 然而,这只会导致来自nuget的所有其他依赖项也缺失。 Can it really be true that I have to manually reference every single nuget for it to work? 难道我必须手动引用每一个nuget才能工作吗?

Turns out it is a problem if you target 4.6.1. 事实证明,如果你的目标是4.6.1,这是一个问题。 It seems to be working now when I changed it to 4.6. 当我把它改成4.6时,它似乎正在工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM