如果您在使用 ASP.NET Core 6 创建应用程序时使用脚手架添加身份验证,可能会遇到以下错误:
No executable found matching command "dotnet-aspnet-codegenerator"
这个问题可能是因为您的应用程序未安装所需的包。您需要安装以下包:
Microsoft.VisualStudio.Web.CodeGeneration.Design
在 Visual Studio 中,可以使用 NuGet 包管理器控制台进行安装:
Install-Package Microsoft.VisualStudio.Web.CodeGeneration.Design
在 .NET CLI 中,可以使用以下命令进行安装:
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
安装完包之后,重新运行命令即可解决这个问题:
dotnet aspnet-codegenerator identity -h
这样您就可以成功运行身份验证的脚手架,并为您的应用程序添加认证功能。