gpt4 book ai didi

azure - Visual Studio 2017 Azure 函数模板没有 run.csx 或 project.json 等文件

转载 作者:行者123 更新时间:2023-12-04 11:20:01 25 4
gpt4 key购买 nike

我正在使用 Visual Studio 2017 预览版(2) 创建 Azure Function。为其生成的模板与我在 Visual Studio 2015 中获得的模板非常不同。

Visual Studio 2017 模板为函数创建一个 .cs 文件,模板结构如下所示:

Visual Studio 2017 Azure Function Template Structure

所有函数都创建为单独的 .cs 文件,并且没有 run.csx、project.json 或 function.json 文件,因此我无法指定函数特定的依赖项和设置

如果我们在 Visual Studio 2015 中看到早期的模板(见下图),它很好地代表了 Azure 门户上可用的文件夹和文件。它在包含所有 .json 和 .csx 文件的单个文件夹中具有功能。此文件夹结构有助于隔离与特定功能相关的文件(VS 2017 模板并非如此)

Visual Studio 2015 Azure Function Template Structure

在 VS 2017 中,我想通过添加 project.json 和 function.json 来指定特定于函数的依赖项和绑定(bind)设置。请告诉我如何实现这一目标?

最佳答案

这是有意的。 Azure Functions 团队改变了在 Visual Studio 2017 中开发和部署 Function Apps 的方式。现在,它基本上是一个已编译的类库,其中的函数是具有适当属性的静态方法。

您不应该再手动编辑function.json;而是使用 WebJob SDK 属性。包管理是通过 NuGet 包以正常的 .NET 方式完成的。

“旧方法”仍然可以在 Azure 门户中进行快速原型(prototype)设计和实验,但 Visual Studio 将不再支持它。

关于azure - Visual Studio 2017 Azure 函数模板没有 run.csx 或 project.json 等文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44208683/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com