简体   繁体   English

VS2022无法创建Azure函数项目

[英]VS2022 Cannot Create Azure Functions Project

If I try to create an Azure Functions Project (Solution->Add->New Project) I get a new project folder that is completely empty, and a status message in the statusbar that says the project was created successfully.如果我尝试创建一个 Azure 函数项目(解决方案->添加->新项目),我会得到一个完全为空的新项目文件夹,并且状态栏中的状态消息表明项目已成功创建。

I've already done a VS Update to 17.1.1 which didn't change anything, then did a complete repair of VS2022 from the VSInstaller.我已经完成了对 17.1.1 的 VS 更新,但没有改变任何内容,然后从 VSInstaller 对 VS2022 进行了完整修复。 I also reinsalled the Azure Functions Core Tools v4 with npm i -g azure-functions-core-tools@4 --unsafe-perm true .我还使用npm i -g azure-functions-core-tools@4 --unsafe-perm true重新安装了 Azure Functions Core Tools v4。

I've tried creating both a net6 and net6 isolated function (timer trigger), but only the empty folder is ever created with no errors shown.我已经尝试创建 net6 和 net6 隔离 function (计时器触发器),但只创建了空文件夹,没有显示错误。

I suppose my alternative at this point is to just manually create/copy a project file and try to go from there.我想我此时的替代方案是手动创建/复制一个项目文件并尝试从那里 go 。

在此处输入图像描述

Current VisualStudio2022 Installation Info当前 VisualStudio2022 安装信息

Microsoft Visual Studio Professional 2022
Version 17.1.1
VisualStudio.17.Release/17.1.1+32228.430
Microsoft .NET Framework
Version 4.8.04161

Installed Version: Professional

.NET Core Debugging with WSL   1.0
.NET Core Debugging with WSL

ADL Tools Service Provider   1.0
This package contains services used by Data Lake tools

ASA Service Provider   1.0

ASP.NET and Web Tools 2019   17.1.358.51495
ASP.NET and Web Tools 2019

ASP.NET Web Frameworks and Tools 2019   17.1.358.51495
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   17.1.358.51495
Azure App Service Tools v3.0.0

Azure Data Lake Tools for Visual Studio   2.6.5000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools   17.1.358.51495
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio   2.6.5000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools   4.1.0-5.22109.6+0c82c4114a4e4b8b723b915eee3b13261db6717f
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Fabric.DiagnosticEvents   1.0
Fabric Diagnostic Events

Microsoft Azure Hive Query Language Service   2.6.5000.0
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio   17.0
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service   2.6.5000.0
Language service for Azure Stream Analytics

Microsoft Azure Tools for Visual Studio   2.9
Support for Azure Cloud Services projects

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager   2.1.161+abc97ecc7d.RR
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio Tools for Containers   1.2
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Node.js Tools   1.5.40105.1 Commit Hash:1822ee94b29c6cf748a19825f14cc26d30b0b871
Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager   6.1.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Razor (ASP.NET Core)   17.0.0.2206201+62a2c1d6162f828801565a7ca26d9d48b810a05b
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools   17.0.62201.12090
Microsoft SQL Server Data Tools

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript Tools   17.0.1229.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   4.1.0-5.22109.6+0c82c4114a4e4b8b723b915eee3b13261db6717f
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   17.1.0-beta.21610.4+07b5673e4f2fa7630e78abe37f16b372353a7242
Microsoft Visual F# Tools

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions   1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.

Visual Studio Tools for Containers   1.0
Visual Studio Tools for Containers

Firstly, tried to create the Azure Functions Timer Trigger with Visual Studio 2022 Community Version 17.1.1 and created successfully:首先,尝试使用 Visual Studio 2022 Community Version 17.1.1 创建 Azure Functions Timer Trigger 并成功创建:

在此处输入图像描述

Also tried in the Visual Studio 2022 Professional Version 17.1.1:还在 Visual Studio 2022 Professional 版本 17.1.1 中尝试过: 在此处输入图像描述

在此处输入图像描述

Below is the installed Visual Studio Professional 2022 Version Product Info:以下是已安装的 Visual Studio Professional 2022 版本产品信息:

Microsoft Visual Studio Professional 2022 (2)
Version 17.1.1
VisualStudio.17.Release/17.1.1+32228.430
Microsoft .NET Framework
Version 4.8.04161

Installed Version: Professional

.NET Core Debugging with WSL   1.0
.NET Core Debugging with WSL

ADL Tools Service Provider   1.0
This package contains services used by Data Lake tools

ASA Service Provider   1.0

ASP.NET and Web Tools 2019   17.1.358.51495
ASP.NET and Web Tools 2019

ASP.NET Web Frameworks and Tools 2019   17.1.358.51495
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   17.1.358.51495
Azure App Service Tools v3.0.0

Azure Data Lake Tools for Visual Studio   2.6.5000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools   17.1.358.51495
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio   2.6.5000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools   4.1.0-5.22109.6+0c82c4114a4e4b8b723b915eee3b13261db6717f
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Cookiecutter   17.0.21344.1
Provides tools for finding, instantiating and customizing templates in cookiecutter format.

Fabric.DiagnosticEvents   1.0
Fabric Diagnostic Events

Microsoft Azure Hive Query Language Service   2.6.5000.0
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio   17.0
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service   2.6.5000.0
Language service for Azure Stream Analytics

Microsoft Azure Tools for Visual Studio   2.9
Support for Azure Cloud Services projects

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager   2.1.161+abc97ecc7d.RR
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio Tools for Containers   1.2
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Node.js Tools   1.5.40105.1 Commit Hash:1822ee94b29c6cf748a19825f14cc26d30b0b871
Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager   6.1.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Office Developer Tools for Visual Studio   17.0.32009.00
Microsoft Office Developer Tools for Visual Studio

Python - Profiling support   17.0.21344.1
Profiling support for Python projects.

Python with Pylance   17.0.21344.1
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.

Razor (ASP.NET Core)   17.0.0.2206201+62a2c1d6162f828801565a7ca26d9d48b810a05b
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools   17.0.62201.12090
Microsoft SQL Server Data Tools

Syntax Visualizer   1.0
An extension for visualizing Roslyn SyntaxTrees.

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript Tools   17.0.1229.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   4.1.0-5.22109.6+0c82c4114a4e4b8b723b915eee3b13261db6717f
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   17.1.0-beta.21610.4+07b5673e4f2fa7630e78abe37f16b372353a7242
Microsoft Visual F# Tools

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions   1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.

Visual Studio Tools for Containers   1.0
Visual Studio Tools for Containers

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Note:笔记:

1. Re-install the .NET 6 SDK and the Runtime Package 1. 重新安装 .NET 6 SDK 和运行时 Package

2. Restart the System and try creating the new Azure Functions Project from Visual Studio 2022 Professional. 2. 重新启动系统并尝试从 Visual Studio 2022 Professional 创建新的 Azure 函数项目。

Updated Answer:更新答案:

Go to Visual Studio Professional 2022 > Tools > Select Get Tools and Features Go 到 Visual Studio Professional 2022 > 工具 > Select获取工具和功能

Uninstall the Azure Development feature from that Catalogue and Re-install it, as shown below:从该目录中卸载 Azure 开发功能并重新安装,如下所示:

VS 工具和功能

I had the same issue using Visual Studio 2022 Professional.我在使用 Visual Studio 2022 Professional 时遇到了同样的问题。 I wasn't able to create an Azure Function v4 (.NET 6) and tried the following workarounds from the previous answers without success:我无法创建 Azure Function v4 (.NET 6) 并尝试了以前的答案中的以下解决方法但没有成功:

  • Reinstalled the Azure Functions Core Tools v4重新安装 Azure 功能核心工具 v4
  • Reinstalled .NET SDK and Azure SDK重新安装 .NET SDK 和 Azure ZF20E3C5E54C0AB3D375D660B3F896F
  • Several computer and Visual Studio restarts多台计算机和 Visual Studio 重新启动

After several actions I was able to make it works again but I don't know which action was important.经过几次操作后,我能够让它再次工作,但我不知道哪个操作很重要。

I listed below all significant actions in the order I did them.我按照我执行的顺序在下面列出了所有重要的操作。 Maybe that will help someone fixing this annoying issue !也许这会帮助某人解决这个烦人的问题!

Check Azure credentials status检查 Azure 凭证状态

I checked that my Azure Credentials were still valid.我检查了我的 Azure 凭据是否仍然有效。 They weren't, I had to refresh them.他们不是,我不得不刷新他们。
In Visual Studio, go to Help > Register Visual Studio dialog, you will see if it's ok.在 Visual Studio 中,go 到Help > Register Visual Studio对话框,你会看到它是否正常。

Screenshot was taken after credential refresh:凭据刷新后截取的屏幕截图:

Visual Studio 帐户设置屏幕截图

Run a function created by a colleague运行一个同事创建的 function

Since I wasn't able to create a new Azure Function inside VS 2022 Pro, I asked a colleague to create one for me to see if I was able to run it locally.由于我无法在 VS 2022 Pro 中创建新的 Azure Function,因此我请一位同事为我创建一个,看看我是否能够在本地运行它。

I was able to run the function my colleague created (debug in VS 2022)我能够运行我同事创建的 function(在 VS 2022 中调试)

Try Visual Studio 2019试用 Visual Studio 2019

I still have Visual Studio 2019 installed and I had the idea to try creating a Function here.我仍然安装了 Visual Studio 2019,并且想尝试在此处创建 Function。

I was able to create a new Azure Function in an empty solution using Visual Studio 2019我能够使用 Visual Studio 2019 在一个空的解决方案中创建一个新的 Azure Function

Try again using Visual Studio 2022使用 Visual Studio 2022 重试

It worked in VS 2019, it's time to try again in Visual Studio 2022.它在 VS 2019 中有效,是时候在 Visual Studio 2022 中重试了。

I was finally able to create an Azure Function project in VS 2022我终于能够在 VS 2022 中创建 Azure Function 项目

As I said earlier, I don't know which action unblocked the issue.正如我之前所说,我不知道哪个操作可以解决问题。 Hope it can help someone else struggling with this issue.希望它可以帮助其他人在这个问题上挣扎。

I finally ended up deleting the following folder:我最终删除了以下文件夹:

C:\Users\YOURUSER\AppData\Local\AzureFunctionsTools C:\Users\YOURUSER\AppData\Local\AzureFunctionsTools

Visual Studio uses the files in the folder to get the last version of Azure Functions Tools. Visual Studio 使用文件夹中的文件来获取 Azure Functions Tools 的最新版本。 If you remove the folder, once you open Visual Studio again, it regenerates that folder and then your Visual Studio is able to get the Azure Function workers如果您删除该文件夹,一旦您再次打开 Visual Studio,它会重新生成该文件夹,然后您的 Visual Studio 能够获取 Azure Function 工作人员

暂无
暂无

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

相关问题 Azure 功能:Blob 存储模拟器在移动到 VS2022 后停止工作 - Azure Functions: Blob Storage emulator stopped working after moving to VS2022 Azure 功能核心工具-使VS2022使用特定版本 - Azure Functions Core Tools - Make VS2022 use specific version 升级到 VS2022 17.2.4 (x64) 后,Working Durable Functions 项目不再在本地工作 - Working Durable Functions Project no longer works locally after upgrading to VS2022 17.2.4 (x64) 如何使 azure function 使用 VS2022 发布的最新代码 - how to make azure function use the latest code published from VS2022 使用 .Net6 (VS2022) 创建的持久 Azure 函数在本地进行调试,导致找不到源 - Durable Azure Function created with .Net6 (VS2022) debugging locally giving Source Not Found 从 VS2022 发布到 Azure Function 没有明显原因失败 - Publishing to Azure Function from VS2022 failing without apparent reason Output 类型为 Class 库的项目无法直接启动,Azure Z86408593C24AF77FDD90DF93 中的 Z86408593C24AF77FDD90DF93 - A project with an Output Type of Class Library cannot be started directly , Azure Function in VS 2022 VS Code 2022 中缺少 Azure Function “创建函数”命令 - Azure Function "create function" command missing in VS Code 2022 与2017年相比,如何在同一项目下以2种不同语言(C#,node.js)创建Azure函数? - How to create Azure Functions in 2 different language(C#, node.js) under the same project vs 2017? Cloud Explorer等效调试VS2022用于上传到存储的压缩发布代码? - Cloud Explorer Equivalent Debug VS2022 for zipped published code uploaded to storage?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM