在 VS 2022 中选择 .NET 6 Web API 时,Program.cs 未创建

When choose .NET 6 Web API in VS 2022, Program.cs is not creaing

我想在 Visual Studio 2022 17.1.6 中开始在 .NET 6 中创建 WEB API,并提供以下信息:

Microsoft Visual Studio Professional 2022
Version 17.1.6
VisualStudio.17.Release/17.1.6+32421.90
Microsoft .NET Framework
Version 4.8.03761

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.363.30963
ASP.NET and Web Tools 2019

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

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

Azure App Service Tools v3.0.0   17.1.363.30963
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.363.30963
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.22165.10+e555772db77ca828b02b4bd547c318387f11d01f
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.

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.62203.25080
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.22165.10+e555772db77ca828b02b4bd547c318387f11d01f
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

我从模板中选择 ASP.NET Core Web API,然后提供项目名称

Create之后,我只得到:

没有Program.cs

为什么?

我设法解决了问题。

似乎本地路径(在其名称中包含 space 或特殊字符的克隆存储库之后)被保存为 C:\test\My%20Api

如果将位置更改为不包含特殊字符的名称(您可以在克隆回购时指定不同的位置)并使用 C:\test\MyApi 之类的有效字符,则创建将起作用。