在 VS 2017 中设置新项目时找不到 Azure Functions

Can't find Azure Functions when setting up new project in VS 2017

我最近开始学习 Azure Functions。我在门户网站上设置了一些,但现在我想在 Visual Studio.

中开发它们

我有 VS 2017 版本 15.3.2,我还安装了 Azure 开发工作负载。我在教程中看到,添加新项目时我应该在“云”选项卡中包含 "Azure Functions" - 但它不存在。我在我的个人电脑和工作电脑上检查过这个。

我在 VS Gallery 上找到了 "Azure Functions and Web Jobs Tools" 插件。它添加了 "Azure Functions" 选项,但它没有像我希望的那样工作。我没有用于添加新功能之类的专用表格。

这个插件有什么错误吗?你知道我是否需要安装更多东西吗?

在 VS2017 中创建一个新的 Azure Function 项目后,它实际上是一个具有 host.json[=43= 的准系统项目].

要创建 Azure 函数,请按照以下步骤操作:

  1. 右键单击项目并选择添加 -> 新建项 -> Azure 函数

  2. 从 Azure 函数模板中选择一个

  3. 您应该会看到为您创建的 Azure Function C# 代码文件。

这是在 VS2017 15.3 及更高版本中开始使用 Azure Function 项目的好指南。

https://blogs.msdn.microsoft.com/webdev/2017/05/10/azure-function-tools-for-visual-studio-2017/

@juvchan 引用的博客 post 对这个问题有一个确切的答案

我安装了 Visual Studio 2017 15.3 和 Azure 开发工作负载,但我没有看到 Azure Functions 项目类型或在尝试构建时收到错误或 运行函数 app

While pulled in automatically by the Azure development workload, Azure Function tools are distributed via the Visual Studio gallery which gives us the flexibility to update them as needed to react to changes on the Azure side which don’t always happen on the Visual Studio schedule.

If for some reason the tools don’t get automatically updated from the gallery, in Visual Studio, go to Tools | Extensions and Updates, and look at the “Updates” tab. If it shows an update is available for “Azure Functions and Web Job Tools” manually update them by clicking the “Update” button.

这帮我修好了

将 visual studio 更新到 15.4+ 对我有用。

Visual Studio 2017 version 15.4 or a later version, including the Azure development workload.

参考 Prerequisites