运行时2的Azure函数;绑定扩展不是自动创建的 [英] Azure Functions with runtime 2; binding extensions not automatically created

查看:69
本文介绍了运行时2的Azure函数;绑定扩展不是自动创建的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我基于v2运行时将Azure Function项目部署到Function App时,不会自动创建项目所依赖的绑定扩展(在我的情况下为Azure存储)。

When I deploy my Azure Function project to my Function App based on the v2 runtime, the binding extensions my project depend on (Azure Storage in my case), are not automatically created.

我在根目录上部署带有extensions.csproj文件的项目,但是在部署之后,我必须手动运行以下命令以在wwwroot上创建bin和obj文件夹。

I deploy my project with an extensions.csproj file on the root, but after deploying I have to manually run the following command to create a bin and obj folder at wwwroot.

dotnet build extensions.csproj -o bin --no-incremental --packages D:\home\.nuget

如果我理解正确,这应该会自动发生。

If I understand correctly, this should happen automatically.

推荐答案

用于通过CLI部署 func azure functionapp发布

For deployment by CLI func azure functionapp publish

功能核心工具的使用zip部署以部署功能,因此kudu不会构建项目默认情况下。要启用此功能,请在门户网站的应用程序设置中将 SCM_DO_BUILD_DURING_DEPLOYMENT 设置为 true

Function core tools use zip deployment to deploy functions, in this way, kudu doesn't build project by default. To enable the feature, set SCM_DO_BUILD_DURING_DEPLOYMENT to true in Application settings on portal.

关于默认设置为何为false的原因,zip部署通常需要部署包括所有相关文件在内的内容,因此无需再次构建。

As for why the default setting is false, zip deployment usually requires the content to be deployed including all related files hence there's no need to build again.

对于Azure功能核心工具,我们通常使用命令 func扩展安装注册扩展名,用于在未自动安装扩展名(如我们从模板创建触发器)的情况下进行输入/输出绑定。这就是为什么命令 func start func azure functionapp publish 无法生成 extensions.csproj的原因,应该在运行或发布功能之前先安装扩展。

For Azure function core tools, we usually use command func extensions install to register extensions for input/output binding when extensions are not installed automatically like we create trigger from template. This is why command func start and func azure functionapp publish doesn't build extensions.csproj, extensions are supposed to be installed before we run or publish functions.

DevOps部署更新

使用Azure管道,我们需要在存档文件之前构建 extensions.csporj 。添加.NET Core构建任务,参数为 -o bin

With Azure pipeline, we need to build extensions.csporj before archive files. Add a .NET Core build task, arguments are -o bin.

如果您希望kudu构建项目,请转到平台功能下的部署中心。选择VSTS作为CI存储库,kudu将为您构建和部署项目。

If you want kudu to build project, go to Deployment Center under Platform features. Choose VSTS as a CI repository and kudu will build and deploy project for you.

这篇关于运行时2的Azure函数;绑定扩展不是自动创建的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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