将Azure函数发布为NuGet包(或从外部程序集加载函数) [英] Publish Azure Function as NuGet package (or load function from external assembly)

查看:64
本文介绍了将Azure函数发布为NuGet包(或从外部程序集加载函数)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑发布可重用的Azure函数作为NuGet包,以便在其他项目中轻松使用它.这样,我可以在其他项目中引用NuGet包.这样,我可以动态组成一组Azure功能,以部署到Azure Function服务.

I'm looking into publishing a reusable Azure Function as a NuGet package, in order to easily consume it in other projects. This way I can reference the NuGet package in other projects. This way I could dynamically compose a set of Azure Functions to be deployed to an Azure Function service.

这当前可行吗?或者,可以运行例如在外部组件中被定义,并被拾取".是由Azure Function主机提供的?

Is this currently possible? Or, can functions e.g. be defined in an external assembly, and be "picked up" by the Azure Function host?

我知道Azure WebJobs可以实现,但是我还没有找到使用Azure Functions实现相同结果的方法.

I know this is possible with Azure WebJobs, but I haven't found a way to achieve the same result using Azure Functions.

推荐答案

.csproj 文件中添加< FunctionsInDependencies> true</FunctionsInDependencies> 技巧.

请确保您确实在代码中(例如在 Startup.cs 中)在某个地方调用了某处的依赖项,以确保该汇编程序未被编译器优化.

Do make sure you actually call the dependency somewhere in the code (e.g. in Startup.cs) to make sure the assembly isn't optimized away by the compiler.

这篇关于将Azure函数发布为NuGet包(或从外部程序集加载函数)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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