简体   繁体   中英

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.

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. I also reinsalled the Azure Functions Core Tools v4 with npm i -g azure-functions-core-tools@4 --unsafe-perm true .

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.

I suppose my alternative at this point is to just manually create/copy a project file and try to go from there.

在此处输入图像描述

Current VisualStudio2022 Installation Info

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:

在此处输入图像描述

Also tried in the Visual Studio 2022 Professional Version 17.1.1: 在此处输入图像描述

在此处输入图像描述

Below is the installed Visual Studio Professional 2022 Version Product Info:

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

2. Restart the System and try creating the new Azure Functions Project from Visual Studio 2022 Professional.

Updated Answer:

Go to Visual Studio Professional 2022 > Tools > Select Get Tools and Features

Uninstall the Azure Development feature from that Catalogue and Re-install it, as shown below:

VS 工具和功能

I had the same issue using 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:

  • Reinstalled the Azure Functions Core Tools v4
  • Reinstalled .NET SDK and Azure SDK
  • Several computer and Visual Studio restarts

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

I checked that my Azure Credentials were still valid. 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.

Screenshot was taken after credential refresh:

Visual Studio 帐户设置屏幕截图

Run a function created by a colleague

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.

I was able to run the function my colleague created (debug in VS 2022)

Try Visual Studio 2019

I still have Visual Studio 2019 installed and I had the idea to try creating a Function here.

I was able to create a new Azure Function in an empty solution using Visual Studio 2019

Try again using Visual Studio 2022

It worked in VS 2019, it's time to try again in Visual Studio 2022.

I was finally able to create an Azure Function project in VS 2022

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

Visual Studio uses the files in the folder to get the last version of 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM